Skip to content

Commit

Permalink
hotfix for (#337) crash on settings change
Browse files Browse the repository at this point in the history
refactored settings pointing to moved preference value to another screen, fixed with moving enable/disable code for status icon to appearance settings fragment
  • Loading branch information
sk-juroot authored and Lineflyer committed Jan 8, 2022
1 parent f194200 commit 62172af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package menion.android.whereyougo.gui.fragments.settings;

import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;

import androidx.preference.CheckBoxPreference;
Expand All @@ -24,6 +25,9 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
CheckBoxPreference imageStretch = findPreference(Preferences.getKey(R.string.pref_KEY_B_IMAGE_STRETCH));

if (statusbarIcon != null) {
if (Preferences.GLOBAL_RUN_SCREEN_OFF && Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
statusbarIcon.setEnabled(false);
}
statusbarIcon.setOnPreferenceChangeListener((preference, o) -> {
boolean newValue = (boolean) o;
Preferences.APPEARANCE_STATUSBAR = Utils.parseBoolean(newValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
runScreenOff.setOnPreferenceChangeListener((preference, o) -> {
boolean newValue = (boolean) o;
Preferences.GLOBAL_RUN_SCREEN_OFF = Utils.parseBoolean(newValue);
CheckBoxPreference status_bar = findPreference(Preferences.getKey(R.string.pref_KEY_B_STATUSBAR));
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P && newValue) {
status_bar.setEnabled(false);
}
PreferenceValues.enableWakeLock();
return true;
});
Expand Down

0 comments on commit 62172af

Please sign in to comment.