diff options
| author | ArenaL5 | 2022-03-20 13:33:58 +0000 |
|---|---|---|
| committer | Jules Aguillon | 2022-03-21 00:39:40 +0100 |
| commit | 47f9043096c245fa56aaa9afd13034cf8f52d1f4 (patch) | |
| tree | 76d3136633b9bc3c1cac4bfc4b9a3b6e1a150cdd | |
| parent | a516246e52e5830f4b7a94691fe02108e6523943 (diff) | |
| download | unexpected-keyboard-47f9043096c245fa56aaa9afd13034cf8f52d1f4.tar.gz unexpected-keyboard-47f9043096c245fa56aaa9afd13034cf8f52d1f4.zip | |
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.
| -rw-r--r-- | srcs/juloo.common/IntSlideBarPreference.java | 4 | ||||
| -rw-r--r-- | srcs/juloo.common/SlideBarPreference.java | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/srcs/juloo.common/IntSlideBarPreference.java b/srcs/juloo.common/IntSlideBarPreference.java index ad5f206..0bdf2c7 100644 --- a/srcs/juloo.common/IntSlideBarPreference.java +++ b/srcs/juloo.common/IntSlideBarPreference.java @@ -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() diff --git a/srcs/juloo.common/SlideBarPreference.java b/srcs/juloo.common/SlideBarPreference.java index 99759de..b41448b 100644 --- a/srcs/juloo.common/SlideBarPreference.java +++ b/srcs/juloo.common/SlideBarPreference.java @@ -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() |
