1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

GBReminderListAdapter gets remindersHaveTime through constructor

addresses https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/4049#issuecomment-2270261
This commit is contained in:
Johannes Krude 2024-08-29 19:38:35 +02:00 committed by José Rebelo
parent e0741d4a13
commit b64841b48e
2 changed files with 6 additions and 4 deletions

View File

@ -66,7 +66,7 @@ public class ConfigureReminders extends AbstractGBActivity {
private static final int REQ_CONFIGURE_REMINDER = 1;
private GBReminderListAdapter mGBReminderListAdapter;
public GBDevice gbDevice;
private GBDevice gbDevice;
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
@ -89,7 +89,7 @@ public class ConfigureReminders extends AbstractGBActivity {
gbDevice = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
mGBReminderListAdapter = new GBReminderListAdapter(this);
mGBReminderListAdapter = new GBReminderListAdapter(this, gbDevice.getDeviceCoordinator().getRemindersHaveTime());
final RecyclerView remindersRecyclerView = findViewById(R.id.reminder_list);
remindersRecyclerView.setHasFixedSize(true);

View File

@ -47,9 +47,11 @@ public class GBReminderListAdapter extends RecyclerView.Adapter<GBReminderListAd
private final Context mContext;
private ArrayList<Reminder> reminderList;
private boolean remindersHaveTime;
public GBReminderListAdapter(Context context) {
public GBReminderListAdapter(Context context, boolean remindersHaveTime) {
this.mContext = context;
this.remindersHaveTime = remindersHaveTime;
}
public void setReminderList(List<Reminder> reminders) {
@ -101,7 +103,7 @@ public class GBReminderListAdapter extends RecyclerView.Adapter<GBReminderListAd
final Date time = reminder.getDate();
SimpleDateFormat format;
if (((ConfigureReminders) mContext).gbDevice.getDeviceCoordinator().getRemindersHaveTime()) {
if (remindersHaveTime) {
format = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
} else {
format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());