mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-09 03:37:03 +01:00
GBReminderListAdapter gets remindersHaveTime through constructor
addresses https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/4049#issuecomment-2270261
This commit is contained in:
parent
e0741d4a13
commit
b64841b48e
@ -66,7 +66,7 @@ public class ConfigureReminders extends AbstractGBActivity {
|
|||||||
private static final int REQ_CONFIGURE_REMINDER = 1;
|
private static final int REQ_CONFIGURE_REMINDER = 1;
|
||||||
|
|
||||||
private GBReminderListAdapter mGBReminderListAdapter;
|
private GBReminderListAdapter mGBReminderListAdapter;
|
||||||
public GBDevice gbDevice;
|
private GBDevice gbDevice;
|
||||||
|
|
||||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
@ -89,7 +89,7 @@ public class ConfigureReminders extends AbstractGBActivity {
|
|||||||
|
|
||||||
gbDevice = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
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);
|
final RecyclerView remindersRecyclerView = findViewById(R.id.reminder_list);
|
||||||
remindersRecyclerView.setHasFixedSize(true);
|
remindersRecyclerView.setHasFixedSize(true);
|
||||||
|
@ -47,9 +47,11 @@ public class GBReminderListAdapter extends RecyclerView.Adapter<GBReminderListAd
|
|||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private ArrayList<Reminder> reminderList;
|
private ArrayList<Reminder> reminderList;
|
||||||
|
private boolean remindersHaveTime;
|
||||||
|
|
||||||
public GBReminderListAdapter(Context context) {
|
public GBReminderListAdapter(Context context, boolean remindersHaveTime) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
|
this.remindersHaveTime = remindersHaveTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReminderList(List<Reminder> reminders) {
|
public void setReminderList(List<Reminder> reminders) {
|
||||||
@ -101,7 +103,7 @@ public class GBReminderListAdapter extends RecyclerView.Adapter<GBReminderListAd
|
|||||||
|
|
||||||
final Date time = reminder.getDate();
|
final Date time = reminder.getDate();
|
||||||
SimpleDateFormat format;
|
SimpleDateFormat format;
|
||||||
if (((ConfigureReminders) mContext).gbDevice.getDeviceCoordinator().getRemindersHaveTime()) {
|
if (remindersHaveTime) {
|
||||||
format = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
|
format = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
|
||||||
} else {
|
} else {
|
||||||
format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
||||||
|
Loading…
Reference in New Issue
Block a user