settings: PremiumSingleChoiceSetting: Fix bug in getting/setting value.

This commit is contained in:
bunnei 2020-04-26 15:33:43 -04:00
parent 541fd6e91e
commit 4f1d1eefc7

View File

@ -35,10 +35,7 @@ public final class PremiumSingleChoiceSetting extends SettingsItem {
}
public int getSelectedValue() {
if (getSetting() == null) {
return 0;
}
return mPreferences.getInt(getSetting().getKey(), 0);
return mPreferences.getInt(getKey(), mDefaultValue);
}
/**
@ -49,9 +46,6 @@ public final class PremiumSingleChoiceSetting extends SettingsItem {
* @return null if overwritten successfully otherwise; a newly created IntSetting.
*/
public void setSelectedValue(int selection) {
if (selection == getSelectedValue()) {
return;
}
final SharedPreferences.Editor editor = mPreferences.edit();
editor.putInt(getKey(), selection);
editor.apply();