public class SeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener
Preference.BaseSavedState, Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener
DEFAULT_ORDER
Constructor and Description |
---|
SeekBarPreference(Context context) |
SeekBarPreference(Context context,
AttributeSet attrs) |
SeekBarPreference(Context context,
AttributeSet attrs,
int defStyle) |
Modifier and Type | Method and Description |
---|---|
int |
getProgress() |
CharSequence |
getSummary()
Returns the summary of this Preference.
|
protected void |
onBindView(View view)
Binds the created View to the data for this Preference.
|
protected Object |
onGetDefaultValue(TypedArray a,
int index)
Called when a Preference is being inflated and the default value
attribute needs to be read.
|
boolean |
onKey(View v,
int keyCode,
KeyEvent event)
Allows a Preference to intercept key events without having focus.
|
void |
onProgressChanged(SeekBar seekBar,
int progress,
boolean fromUser)
Notification that the progress level has changed.
|
protected void |
onRestoreInstanceState(Parcelable state)
Hook allowing a Preference to re-apply a representation of its internal
state that had previously been generated by
Preference.onSaveInstanceState() . |
protected Parcelable |
onSaveInstanceState()
Hook allowing a Preference to generate a representation of its internal
state that can later be used to create a new instance with that same
state.
|
protected void |
onSetInitialValue(boolean restoreValue,
Object defaultValue)
Implement this to set the initial value of the Preference.
|
void |
onStartTrackingTouch(SeekBar seekBar)
Notification that the user has started a touch gesture.
|
void |
onStopTrackingTouch(SeekBar seekBar)
Notification that the user has finished a touch gesture.
|
void |
setMax(int max) |
void |
setProgress(int progress) |
callChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getEditor, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPersistedStringSet, getPreferenceManager, getSharedPreferences, getShouldDisableView, getTitle, getTitleRes, getView, getWidgetLayoutResource, hasKey, isEnabled, isPersistent, isSelectable, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToActivity, onAttachedToHierarchy, onClick, onCreateView, onDependencyChanged, onPrepareForRemoval, peekExtras, persistBoolean, persistFloat, persistInt, persistLong, persistString, persistStringSet, restoreHierarchyState, saveHierarchyState, setDefaultValue, setDependency, setEnabled, setFragment, setIcon, setIcon, setIntent, setKey, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setSelectable, setShouldDisableView, setSummary, setSummary, setTitle, setTitle, setWidgetLayoutResource, shouldCommit, shouldDisableDependents, shouldPersist, toString
public SeekBarPreference(Context context, AttributeSet attrs, int defStyle)
public SeekBarPreference(Context context, AttributeSet attrs)
public SeekBarPreference(Context context)
protected void onBindView(View view)
Preference
This is a good place to grab references to custom Views in the layout and set properties on them.
Make sure to call through to the superclass's implementation.
onBindView
in class Preference
view
- The View that shows this Preference.Preference.onCreateView(ViewGroup)
public CharSequence getSummary()
Preference
getSummary
in class Preference
Preference.setSummary(CharSequence)
protected void onSetInitialValue(boolean restoreValue, Object defaultValue)
Preference
If restorePersistedValue is true, you should restore the
Preference value from the SharedPreferences
. If
restorePersistedValue is false, you should set the Preference
value to defaultValue that is given (and possibly store to SharedPreferences
if Preference.shouldPersist()
is true).
This may not always be called. One example is if it should not persist but there is no default value given.
onSetInitialValue
in class Preference
restoreValue
- True to restore the persisted value;
false to use the given defaultValue.defaultValue
- The default value for this Preference. Only use this
if restorePersistedValue is false.protected Object onGetDefaultValue(TypedArray a, int index)
Preference
For example, if the value type is String, the body of the method would
proxy to TypedArray.getString(int)
.
onGetDefaultValue
in class Preference
a
- The set of attributes.index
- The index of the default value attribute.public boolean onKey(View v, int keyCode, KeyEvent event)
Preference
onKey
in class Preference
public void setMax(int max)
public void setProgress(int progress)
public int getProgress()
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
SeekBar.OnSeekBarChangeListener
onProgressChanged
in interface SeekBar.OnSeekBarChangeListener
seekBar
- The SeekBar whose progress has changedprogress
- The current progress level. This will be in the range 0..max where max
was set by ProgressBar.setMax(int)
. (The default value for max is 100.)fromUser
- True if the progress change was initiated by the user.public void onStartTrackingTouch(SeekBar seekBar)
SeekBar.OnSeekBarChangeListener
onStartTrackingTouch
in interface SeekBar.OnSeekBarChangeListener
seekBar
- The SeekBar in which the touch gesture beganpublic void onStopTrackingTouch(SeekBar seekBar)
SeekBar.OnSeekBarChangeListener
onStopTrackingTouch
in interface SeekBar.OnSeekBarChangeListener
seekBar
- The SeekBar in which the touch gesture beganprotected Parcelable onSaveInstanceState()
Preference
onSaveInstanceState
in class Preference
Preference.onRestoreInstanceState(android.os.Parcelable)
,
Preference.saveHierarchyState(android.os.Bundle)
protected void onRestoreInstanceState(Parcelable state)
Preference
Preference.onSaveInstanceState()
.
This function will never be called with a null state.onRestoreInstanceState
in class Preference
state
- The saved state that had previously been returned by
Preference.onSaveInstanceState()
.Preference.onSaveInstanceState()
,
Preference.restoreHierarchyState(android.os.Bundle)