settings: PremiumSingleChoiceSetting: Fix bug in getting/setting value.
This commit is contained in:
parent
380f5bc77f
commit
01a74a9fc5
@ -35,10 +35,7 @@ public final class PremiumSingleChoiceSetting extends SettingsItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSelectedValue() {
|
public int getSelectedValue() {
|
||||||
if (getSetting() == null) {
|
return mPreferences.getInt(getKey(), mDefaultValue);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return mPreferences.getInt(getSetting().getKey(), 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,9 +46,6 @@ public final class PremiumSingleChoiceSetting extends SettingsItem {
|
|||||||
* @return null if overwritten successfully otherwise; a newly created IntSetting.
|
* @return null if overwritten successfully otherwise; a newly created IntSetting.
|
||||||
*/
|
*/
|
||||||
public void setSelectedValue(int selection) {
|
public void setSelectedValue(int selection) {
|
||||||
if (selection == getSelectedValue()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
editor.putInt(getKey(), selection);
|
editor.putInt(getKey(), selection);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user