mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +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() {
|
holder.isEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
if (isChecked) {
|
||||||
|
alarm.setUnused(false);
|
||||||
|
holder.container.setAlpha(1.0f);
|
||||||
|
}
|
||||||
alarm.setEnabled(isChecked);
|
alarm.setEnabled(isChecked);
|
||||||
updateInDB(alarm);
|
updateInDB(alarm);
|
||||||
}
|
}
|
||||||
@ -104,6 +108,7 @@ public class GBAlarmListAdapter extends RecyclerView.Adapter<GBAlarmListAdapter.
|
|||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
alarm.setUnused(!alarm.getUnused());
|
alarm.setUnused(!alarm.getUnused());
|
||||||
holder.container.setAlpha(alarm.getUnused() ? 0.5f : 1.0f);
|
holder.container.setAlpha(alarm.getUnused() ? 0.5f : 1.0f);
|
||||||
|
holder.isEnabled.setChecked(false); // This falls through to the onCheckChanged function
|
||||||
updateInDB(alarm);
|
updateInDB(alarm);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user