Correct displayed value when cancelling settings modification

When changing any numeric setting and cancelling this change, the change would not
be persisted, but the summary in the setting screen would show the last position
of the slider instead of the correct unchanged value.

This commit fixes this on the most simple way by resetting the slider position to
the persisted value.
This commit is contained in:
ArenaL5 2022-03-20 13:33:58 +00:00 committed by Jules Aguillon
parent a516246e52
commit 47f9043096
2 changed files with 8 additions and 0 deletions

View File

@ -95,6 +95,10 @@ public class IntSlideBarPreference extends DialogPreference
{
if (positiveResult)
persistInt(_seekBar.getProgress() + _min);
else
_seekBar.setProgress(getPersistedInt(_min) - _min);
updateText();
}
protected View onCreateDialogView()

View File

@ -99,6 +99,10 @@ public class SlideBarPreference extends DialogPreference
{
if (positiveResult)
persistFloat(_value);
else
_seekBar.setProgress((int)((getPersistedFloat(_min) - _min) * STEPS / (_max - _min)));
updateText();
}
protected View onCreateDialogView()