Skip to content

Commit

Permalink
Event List viewer: add persistence for checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Nov 28, 2016
1 parent 69a7ab3 commit 835f74b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/src/main/java/com/eveningoutpost/dexdrip/ErrorsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import com.eveningoutpost.dexdrip.Models.JoH;
import com.eveningoutpost.dexdrip.Models.UserError;
import com.eveningoutpost.dexdrip.UtilityModels.PersistentStore;
import com.eveningoutpost.dexdrip.UtilityModels.SendFeedBack;
import com.eveningoutpost.dexdrip.utils.ActivityWithMenu;

Expand Down Expand Up @@ -69,10 +70,10 @@ protected void onCreate(Bundle savedInstanceState) {
final String str = bundle.getString("events");
if (str != null) {
userEventHighCheckboxView.setChecked(true);
userEventLowCheckboxView.setChecked(false);
mediumCheckboxView.setChecked(false);
highCheckboxView.setChecked(false);
lowCheckboxView.setChecked(false);
userEventLowCheckboxView.setChecked(PersistentStore.getBoolean("events-userlowcheckbox"));
mediumCheckboxView.setChecked(PersistentStore.getBoolean("events-mediumcheckbox"));
highCheckboxView.setChecked(PersistentStore.getBoolean("events-highcheckbox"));
lowCheckboxView.setChecked(PersistentStore.getBoolean("events-lowcheckbox"));
}
}
}
Expand Down Expand Up @@ -155,6 +156,13 @@ public void updateErrors() {

public void updateErrors(boolean from_timer) {
List<Integer> severitiesList = new ArrayList<>();

PersistentStore.setBoolean("events-highcheckbox", highCheckboxView.isChecked());
PersistentStore.setBoolean("events-mediumcheckbox", mediumCheckboxView.isChecked());
PersistentStore.setBoolean("events-lowcheckbox", lowCheckboxView.isChecked());
PersistentStore.setBoolean("events-userlowcheckbox", userEventLowCheckboxView.isChecked());
PersistentStore.setBoolean("events-userhighcheckbox", userEventHighCheckboxView.isChecked());

if (highCheckboxView.isChecked()) severitiesList.add(3);
if (mediumCheckboxView.isChecked()) severitiesList.add(2);
if (lowCheckboxView.isChecked()) severitiesList.add(1);
Expand Down

0 comments on commit 835f74b

Please sign in to comment.