support: Fix persistence for helper prefs
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
diff --git a/src/com/bliss/support/preferences/GlobalSettingSwitchPreference.java b/src/com/bliss/support/preferences/GlobalSettingSwitchPreference.java
index 813092c..fec3f77 100644
--- a/src/com/bliss/support/preferences/GlobalSettingSwitchPreference.java
+++ b/src/com/bliss/support/preferences/GlobalSettingSwitchPreference.java
@@ -57,8 +57,7 @@
}
@Override
- protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
- setChecked(Settings.System.getString(getContext().getContentResolver(), getKey()) != null ? getPersistedBoolean(isChecked())
- : (Boolean) defaultValue);
+ protected boolean isPersisted() {
+ return Settings.Global.getString(getContext().getContentResolver(), getKey()) != null;
}
}
diff --git a/src/com/bliss/support/preferences/SecureSettingSwitchPreference.java b/src/com/bliss/support/preferences/SecureSettingSwitchPreference.java
index fd9a4ba..5349ce4 100644
--- a/src/com/bliss/support/preferences/SecureSettingSwitchPreference.java
+++ b/src/com/bliss/support/preferences/SecureSettingSwitchPreference.java
@@ -57,8 +57,7 @@
}
@Override
- protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
- setChecked(Settings.System.getString(getContext().getContentResolver(), getKey()) != null ? getPersistedBoolean(isChecked())
- : (Boolean) defaultValue);
+ protected boolean isPersisted() {
+ return Settings.Secure.getString(getContext().getContentResolver(), getKey()) != null;
}
}
diff --git a/src/com/bliss/support/preferences/SystemSettingSwitchPreference.java b/src/com/bliss/support/preferences/SystemSettingSwitchPreference.java
index 70f862b..51ce015 100644
--- a/src/com/bliss/support/preferences/SystemSettingSwitchPreference.java
+++ b/src/com/bliss/support/preferences/SystemSettingSwitchPreference.java
@@ -57,8 +57,7 @@
}
@Override
- protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
- setChecked(Settings.System.getString(getContext().getContentResolver(), getKey()) != null ? getPersistedBoolean(isChecked())
- : (Boolean) defaultValue);
+ protected boolean isPersisted() {
+ return Settings.System.getString(getContext().getContentResolver(), getKey()) != null;
}
}