mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +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:
parent
0383169767
commit
37b5d0404a
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user