use of nodomain.freeyourgadget.gadgetbridge.activities.ConfigureReminders in project Gadgetbridge by Freeyourgadget.
the class GBReminderListAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
final Reminder reminder = reminderList.get(position);
holder.container.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((ConfigureReminders) mContext).configureReminder(reminder);
}
});
holder.container.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
new AlertDialog.Builder(v.getContext()).setTitle(R.string.reminder_delete_confirm_title).setMessage(R.string.reminder_delete_confirm_description).setIcon(R.drawable.ic_warning).setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, final int whichButton) {
((ConfigureReminders) mContext).deleteReminder(reminder);
}
}).setNegativeButton(android.R.string.no, null).show();
return true;
}
});
holder.reminderMessage.setText(reminder.getMessage());
final Date time = reminder.getDate();
final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
int stringResId = 0;
switch(reminder.getRepetition()) {
case Reminder.ONCE:
stringResId = R.string.reminder_time_once;
break;
case Reminder.EVERY_DAY:
stringResId = R.string.reminder_time_every_day;
break;
case Reminder.EVERY_WEEK:
stringResId = R.string.reminder_time_every_week;
break;
case Reminder.EVERY_MONTH:
stringResId = R.string.reminder_time_every_month;
break;
case Reminder.EVERY_YEAR:
stringResId = R.string.reminder_time_every_year;
break;
}
final String reminderTimeText = mContext.getString(stringResId, format.format(time));
holder.reminderTime.setText(reminderTimeText);
}
Aggregations