This commit is contained in:
serso
2011-09-25 11:12:59 +04:00
parent ce416f56e0
commit 7921c09f45
7 changed files with 75 additions and 34 deletions

View File

@@ -137,8 +137,9 @@ public abstract class AbstractDialogPreference<T> extends DialogPreference {
private void persist(@Nullable T value) {
final String toBePersistedString = getMapper().formatValue(value);
if (toBePersistedString != null) {
persistString(toBePersistedString);
callChangeListener(value);
if ( callChangeListener(value) ) {
persistString(toBePersistedString);
}
}
}

View File

@@ -24,18 +24,26 @@ public abstract class RangeSeekBarPreference<T extends Number> extends AbstractD
@NotNull
private final Interval<T> boundaries;
private Integer steps;
public RangeSeekBarPreference(@NotNull Context context, AttributeSet attrs) {
super(context, attrs, null);
//noinspection ConstantConditions
boundaries = getMapper().parseValue(attrs.getAttributeValue(localNameSpace, "boundaries"));
assert boundaries != null;
steps = attrs.getAttributeIntValue(localNameSpace, "steps", -1);
if ( steps.equals(-1) ) {
steps = null;
}
assert steps == null || steps >= 2;
createPreferenceView();
}
private void createPreferenceView() {
this.rangeSeekBar = new NumberRangeSeekBar<T>(boundaries, null, context);
this.rangeSeekBar = new NumberRangeSeekBar<T>(boundaries, steps, context);
this.rangeSeekBar.setNotifyWhileDragging(true);
this.rangeSeekBar.setOnRangeSeekBarChangeListener(this);