When you close the app(swipe it out of the recently open apps) and then open the app, the app always starts in the "visible" mode, regardless what mode was displayed before.
The code itself suggests it different in the "MainActivity.java" https://github.com/amarradi/leafpad/blob/development/app/src/main/java/com/git/amarradi/leafpad/MainActivity.java#L231:
boolean savedShowHidden = Leafpad.getInstance().getSavedShowHidden();
noteViewModel.setShowHidden(savedShowHidden);
This happens directly after the load/creation of the viewmodel, where setShowHidden loads the current list.
In theory, since you use a shared preference value it should start in the mode (visible or hidden) in that the app was running when it got swiped out of the recent apps, but it does not.
This problem also exists in older versions of the app.
public boolean getSavedShowHidden() {
SharedPreferences prefs = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
return prefs.getBoolean(PREF_SHOW_HIDDEN, false);
}
public void saveShowHidden(boolean showHidden) {
SharedPreferences prefs = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
prefs.edit().putBoolean(PREF_SHOW_HIDDEN, showHidden).apply();
}
When you close the app(swipe it out of the recently open apps) and then open the app, the app always starts in the "visible" mode, regardless what mode was displayed before.
The code itself suggests it different in the "MainActivity.java" https://github.com/amarradi/leafpad/blob/development/app/src/main/java/com/git/amarradi/leafpad/MainActivity.java#L231:
This happens directly after the load/creation of the viewmodel, where setShowHidden loads the current list.
In theory, since you use a shared preference value it should start in the mode (visible or hidden) in that the app was running when it got swiped out of the recent apps, but it does not.
This problem also exists in older versions of the app.