1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 03:16:51 +01:00

Update alarm unused and enabled states

- Set alarm as used when enabled in the list
- Set alarm as disabled when set as unused in the list
This commit is contained in:
Martin.JM 2024-02-21 13:25:15 +01:00
parent 0383169767
commit 37b5d0404a

View File

@ -88,6 +88,10 @@ public class GBAlarmListAdapter extends RecyclerView.Adapter<GBAlarmListAdapter.
holder.isEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
alarm.setUnused(false);
holder.container.setAlpha(1.0f);
}
alarm.setEnabled(isChecked);
updateInDB(alarm);
}
@ -104,6 +108,7 @@ public class GBAlarmListAdapter extends RecyclerView.Adapter<GBAlarmListAdapter.
public boolean onLongClick(View v) {
alarm.setUnused(!alarm.getUnused());
holder.container.setAlpha(alarm.getUnused() ? 0.5f : 1.0f);
holder.isEnabled.setChecked(false); // This falls through to the onCheckChanged function
updateInDB(alarm);
return true;
}