Skip to content

Commit

Permalink
ProperSeekBarPreference: Adapt for existing prefs
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Vashi <[email protected]>
  • Loading branch information
neobuddy89 authored and ralf979 committed Feb 8, 2023
1 parent 3932c82 commit 464245f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
public class ProperSeekBarPreference 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;
Expand Down Expand Up @@ -72,7 +73,7 @@ public ProperSeekBarPreference(Context context, AttributeSet attrs, int defStyle
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;
Expand Down Expand Up @@ -269,6 +270,11 @@ public void setDefaultValue(String newValue, boolean update) {
}
}

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) {
Expand Down

0 comments on commit 464245f

Please sign in to comment.