Adapt new custom seekbar preference for existing prefs
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Change-Id: Ic3c3343f8d8904db8176c1655b5713d64ffb2ea1
diff --git a/src/com/bliss/support/preferences/CustomSeekBarPreference.java b/src/com/bliss/support/preferences/CustomSeekBarPreference.java
index 06caab0..97c8a51 100644
--- a/src/com/bliss/support/preferences/CustomSeekBarPreference.java
+++ b/src/com/bliss/support/preferences/CustomSeekBarPreference.java
@@ -34,6 +34,7 @@
public class CustomSeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener,
View.OnClickListener, View.OnLongClickListener {
protected final String TAG = getClass().getName();
+ private static final String SETTINGS_NS = "http://schemas.android.com/apk/res/com.android.settings";
protected static final String ANDROIDNS = "http://schemas.android.com/apk/res/android";
protected int mInterval = 1;
@@ -72,7 +73,7 @@
a.recycle();
}
- mMinValue = attrs.getAttributeIntValue(ANDROIDNS, "min", mMinValue);
+ mMinValue = attrs.getAttributeIntValue(SETTINGS_NS, "min", mMinValue);
mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", mMaxValue);
if (mMaxValue < mMinValue)
mMaxValue = mMinValue;
@@ -269,6 +270,11 @@
}
}
+ public void setValue(int newValue) {
+ mValue = getLimitedValue(newValue);
+ if (mSeekBar != null) mSeekBar.setProgress(getSeekValue(mValue));
+ }
+
public void setValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (mValue != newValue) {