public class SettingEditDialogPreference extends SettingDialogPreference<EditDialog.EditOptions>
SettingDialogPreference implementation that may be used to allow to a user to specify
its preferred input text for a specific setting preference.
This preference implementation by default displays the preferred input text as its summary text
if it is specified, or the standard summary text if there is no input text persisted. The preferred
input text may be specified via setInput(String) and obtained via getInput().
When SettingDialogPreference.handleOnDialogButtonClick(Dialog, int) is called, this preference implementation
handles only EditDialog type of dialog. If its Dialog#BUTTON_POSITIVE button has
been clicked, the input provided via EditDialog#getInput() is set as input for this
preference via setInput(String).
String. See TypedArray.getString(int).
SettingDialogPreference,
SettingEditDialogPreference Attributes
uiSettingEditDialogPreferenceStyleSettingDialogPreference.OnClickListenerNO_DIALOG_ID| Constructor and Description |
|---|
SettingEditDialogPreference(android.content.Context context)
Same as
SettingEditDialogPreference(Context, AttributeSet) without attributes. |
SettingEditDialogPreference(android.content.Context context,
android.util.AttributeSet attrs)
Same as
SettingEditDialogPreference(Context, AttributeSet, int) with
R.attr#uiSettingEditDialogPreferenceStyle as attribute for default style. |
SettingEditDialogPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
Same as
SettingEditDialogPreference(Context, AttributeSet, int, int) with 0 as
default style. |
SettingEditDialogPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
Creates a new instance of SettingEditDialogPreference for the given context.
|
| Modifier and Type | Method and Description |
|---|---|
EditDialog.EditOptions |
getDialogOptions()
Dialog options of this preference with the preferred input specified as
EditDialog.EditOptions#content(CharSequence), if it is set. |
String |
getInput()
Returns the preferred input value of this preference.
|
void |
onBindView(android.view.View view) |
protected void |
onConfigureDialogOptions(EditDialog.EditOptions options,
android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
Called from one of constructors to configure dialog options specific for this dialog preference.
|
protected EditDialog.EditOptions |
onCreateDialogOptions(android.content.res.Resources resources)
Called to create instance of dialog options specific for this dialog preference.
|
protected Object |
onGetDefaultValue(android.content.res.TypedArray typedArray,
int index) |
protected CharSequence |
onGetSummaryText()
Called from
SettingDialogPreference.synchronizeSummaryView(View) to retrieve the current summary text for
this dialog preference. |
protected boolean |
onHandleDialogButtonClick(Dialog dialog,
int button)
Called from
SettingDialogPreference.handleOnDialogButtonClick(Dialog, int) if the given dialog has
id associated with this dialog preference. |
protected void |
onSetInitialValue(boolean restorePersistedValue,
Object defaultValue) |
void |
setInput(String input)
Sets a preferred input value for this preference.
|
getDialogId, handleOnDialogButtonClick, setOnClickListener, synchronizeSummaryViewsetKeycallChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getEditor, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPersistedStringSet, getPreferenceManager, getSharedPreferences, getShouldDisableView, getSummary, getTitle, getTitleRes, getView, getWidgetLayoutResource, hasKey, isEnabled, isPersistent, isSelectable, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToActivity, onAttachedToHierarchy, onClick, onCreateView, onDependencyChanged, onParentChanged, onPrepareForRemoval, onRestoreInstanceState, onSaveInstanceState, peekExtras, persistBoolean, persistFloat, persistInt, persistLong, persistString, persistStringSet, restoreHierarchyState, saveHierarchyState, setDefaultValue, setDependency, setEnabled, setFragment, setIcon, setIcon, setIntent, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setSelectable, setShouldDisableView, setSummary, setSummary, setTitle, setTitle, setWidgetLayoutResource, shouldCommit, shouldDisableDependents, shouldPersist, toStringpublic SettingEditDialogPreference(android.content.Context context)
SettingEditDialogPreference(Context, AttributeSet) without attributes.public SettingEditDialogPreference(android.content.Context context,
android.util.AttributeSet attrs)
SettingEditDialogPreference(Context, AttributeSet, int) with
R.attr#uiSettingEditDialogPreferenceStyle as attribute for default style.public SettingEditDialogPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
SettingEditDialogPreference(Context, AttributeSet, int, int) with 0 as
default style.public SettingEditDialogPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
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 void onConfigureDialogOptions(EditDialog.EditOptions options,
android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
SettingDialogPreferenceonConfigureDialogOptions in class SettingDialogPreference<EditDialog.EditOptions>options - The options created via SettingDialogPreference.onCreateDialogOptions(Resources).protected EditDialog.EditOptions onCreateDialogOptions(android.content.res.Resources resources)
SettingDialogPreference
Default implementation creates instance of DialogOptions.
onCreateDialogOptions in class SettingDialogPreference<EditDialog.EditOptions>resources - Application resources that may be used supply default values from resources
for the options.protected Object onGetDefaultValue(android.content.res.TypedArray typedArray, int index)
onGetDefaultValue in class android.preference.Preferenceprotected void onSetInitialValue(boolean restorePersistedValue,
Object defaultValue)
onSetInitialValue in class android.preference.Preferencepublic void setInput(String input)
If value of this preference changes, it is persisted and the change listener is notified about the change.
input - The preferred input to be persisted.getInput()public String getInput()
setInput(String),
getDialogOptions()public void onBindView(android.view.View view)
onBindView in class SettingPreferenceprotected CharSequence onGetSummaryText()
SettingDialogPreferenceSettingDialogPreference.synchronizeSummaryView(View) to retrieve the current summary text for
this dialog preference.
Default implementation returns the text provided by Preference.getSummary() method.
onGetSummaryText in class SettingDialogPreference<EditDialog.EditOptions>public EditDialog.EditOptions getDialogOptions()
EditDialog.EditOptions#content(CharSequence), if it is set.getDialogOptions in class SettingDialogPreference<EditDialog.EditOptions>getInput()protected boolean onHandleDialogButtonClick(Dialog dialog,
int button)
SettingDialogPreferenceSettingDialogPreference.handleOnDialogButtonClick(Dialog, int) if the given dialog has
id associated with this dialog preference.onHandleDialogButtonClick in class SettingDialogPreference<EditDialog.EditOptions>dialog - The dialog where the button has been clicked.button - The clicked dialog button.True if the button click event has been successfully handled, false
otherwise.