From 64483f2bd536133f5918defefbf2c1cca0153347 Mon Sep 17 00:00:00 2001 From: ezio84 Date: Thu, 25 May 2017 23:45:57 +0200 Subject: [PATCH] CustomSeekBar: fix progressbar glitch with custom min-max values when CustomSeekBar is called, it does: mSeekBar.setMax(mMax - mMin); assuming mMin=0 and mMax=100 if they are not set with settings:min or max through the related menu xml. So if we set one of those values in the related menu java class with the available public voids (setMax(value) and setMin(value)) the seekbar doesn't get the new min and max thus the user can't slide it to the max position. To reply: - set settings:max (or android:max according to your customseekbar implementation) to the wanted value, e.g. 255; - set the min value through your menu java class with CustomSeekBarPreference.setMin(value); - try to move the progressbar thumb to the max position, it won't reach it. Signed-off-by: xyyx --- .../cherish/settings/preferences/CustomSeekBarPreference.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/com/cherish/settings/preferences/CustomSeekBarPreference.java b/src/com/cherish/settings/preferences/CustomSeekBarPreference.java index 4ba5852..a101ca3 100644 --- a/src/com/cherish/settings/preferences/CustomSeekBarPreference.java +++ b/src/com/cherish/settings/preferences/CustomSeekBarPreference.java @@ -139,10 +139,12 @@ public class CustomSeekBarPreference extends Preference implements SeekBar.OnSee public void setMax(int max) { mMax = max; + mSeekBar.setMax(mMax - mMin); } public void setMin(int min) { mMin = min; + mSeekBar.setMax(mMax - mMin); } public void setIntervalValue(int value) {