public class SettingSeekBarPreference extends SettingPreference
SettingPreference implementation that provides SeekBar widget with its related
functionality.
This preference implementation by default displays the preferred progress via SeekBar
widget in the area of the standard summary text (instead of it). The preferred progress may be
specified via setProgress(int) and obtained via getProgress(). Also the maximum
progress value that should be handled by the associated SeekBar widget may be specified via
setMaxProgress(int).
Integer. See TypedArray.getInt(int, int).
SettingPreference,
SettingSeekBarPreference Attributes
settingSeekBarPreferenceStyleandroidx.preference.Preference.BaseSavedState, androidx.preference.Preference.OnPreferenceChangeListener, androidx.preference.Preference.OnPreferenceClickListener, androidx.preference.Preference.SummaryProvider<T extends androidx.preference.Preference>| Constructor and Description |
|---|
SettingSeekBarPreference(android.content.Context context)
Same as
SettingSeekBarPreference(Context, AttributeSet) without attributes. |
SettingSeekBarPreference(android.content.Context context,
android.util.AttributeSet attrs)
Same as
SettingSeekBarPreference(Context, AttributeSet, int) with
R.attr.settingSeekBarPreferenceStyle as attribute for default style. |
SettingSeekBarPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
Same as
SettingSeekBarPreference(Context, AttributeSet, int, int) with 0
as default style. |
SettingSeekBarPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
Creates a new instance of SettingSeekBarPreference for the given context.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxProgress()
Returns the maximum value for progress specified for this preference.
|
int |
getProgress()
Returns the preferred progress value of this preference.
|
void |
onBindViewHolder(androidx.preference.PreferenceViewHolder holder) |
protected Object |
onGetDefaultValue(android.content.res.TypedArray attributes,
int index) |
protected void |
onSetInitialValue(Object defaultValue) |
void |
setMaxProgress(int maxProgress)
Sets a maximum value for the progress that may be specified for this preference.
|
void |
setProgress(int progress)
Sets a preferred progress value for this preference.
|
setKeycallChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getParent, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPersistedStringSet, getPreferenceDataStore, getPreferenceManager, getSharedPreferences, getShouldDisableView, getSummary, getSummaryProvider, getTitle, getWidgetLayoutResource, hasKey, isCopyingEnabled, isEnabled, isIconSpaceReserved, isPersistent, isSelectable, isShown, isSingleLineTitle, isVisible, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttached, onAttachedToHierarchy, onAttachedToHierarchy, onClick, onDependencyChanged, onDetached, onInitializeAccessibilityNodeInfo, onParentChanged, onPrepareForRemoval, onRestoreInstanceState, onSaveInstanceState, onSetInitialValue, peekExtras, performClick, performClick, persistBoolean, persistFloat, persistInt, persistLong, persistString, persistStringSet, restoreHierarchyState, saveHierarchyState, setCopyingEnabled, setDefaultValue, setDependency, setEnabled, setFragment, setIcon, setIcon, setIconSpaceReserved, setIntent, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setPreferenceDataStore, setSelectable, setShouldDisableView, setSingleLineTitle, setSummary, setSummary, setSummaryProvider, setTitle, setTitle, setViewId, setVisible, setWidgetLayoutResource, shouldDisableDependents, shouldPersist, toStringpublic SettingSeekBarPreference(@NonNull
android.content.Context context)
SettingSeekBarPreference(Context, AttributeSet) without attributes.public SettingSeekBarPreference(@NonNull
android.content.Context context,
@Nullable
android.util.AttributeSet attrs)
SettingSeekBarPreference(Context, AttributeSet, int) with
R.attr.settingSeekBarPreferenceStyle as attribute for default style.public SettingSeekBarPreference(@NonNull
android.content.Context context,
@Nullable
android.util.AttributeSet attrs,
@AttrRes
int defStyleAttr)
SettingSeekBarPreference(Context, AttributeSet, int, int) with 0
as default style.public SettingSeekBarPreference(@NonNull
android.content.Context context,
@Nullable
android.util.AttributeSet attrs,
@AttrRes
int defStyleAttr,
@StyleRes
int defStyleRes)
context - Context in which will be the new setting preference presented.attrs - Set of Xml attributes used to configure the new instance of this preference.defStyleAttr - An attribute which contains a reference to a default style resource for
this preference within a theme of the given context.defStyleRes - Resource id of the default style for the new preference.protected Object onGetDefaultValue(@NonNull android.content.res.TypedArray attributes, int index)
onGetDefaultValue in class androidx.preference.Preferenceprotected void onSetInitialValue(@Nullable
Object defaultValue)
onSetInitialValue in class androidx.preference.Preferencepublic void setMaxProgress(int maxProgress)
Note, that this value is not used to ensure that the progress specified via setProgress(int)
is in bounds of the maximum progress value, but only for purpose of AbsSeekBar.setMax(int).
maxProgress - The desired maximum progress value.R.attr.max,
getMaxProgress()public int getMaxProgress()
setMaxProgress(int)public void setProgress(int progress)
If value of this preference changes, it is persisted and the change listener is notified about the change.
progress - The preferred progress to be persisted. Should be from the range [0, getMaxProgress()].getProgress()public int getProgress()
setProgress(int)public void onBindViewHolder(@NonNull
androidx.preference.PreferenceViewHolder holder)
onBindViewHolder in class SettingPreference