public final class SettingDateDialogPreference extends SettingDateTimeDialogPreference<DatePickerDialog.DateOptions>
SettingDateTimeDialogPreference implementation that may be used to allow to a user to pick
its preferred date for a specific setting preference.
This preference implementation by default displays the preferred date formatted by format specified
via SettingDateTimeDialogPreference.setFormat(SimpleDateFormat) as summary text. The default format is 'MMM dd, yyyy'.
If no date is specified, the standard summary text is displayed. The preferred date may be specified
via setDate(long) and obtained via getDate() or getDateInMillis().
When SettingDialogPreference.handleOnDialogButtonClick(Dialog, int) is called, this preference implementation
handles only DatePickerDialog type of dialog. If its Dialog#BUTTON_POSITIVE button
has been clicked, the date provided via DatePickerDialog#getDate() is set as date for
this preference via setDate(long).
String into milliseconds value
using DatePickerDialog.DateParser#parse(String). See TypedArray.getString(int).
SettingDateTimeDialogPreference,
SettingDateDialogPreference Attributes
uiSettingDateDialogPreferenceStyleSettingDialogPreference.OnClickListenerNO_DIALOG_ID| Constructor and Description |
|---|
SettingDateDialogPreference(android.content.Context context)
Same as
SettingDateDialogPreference(Context, AttributeSet) without attributes. |
SettingDateDialogPreference(android.content.Context context,
android.util.AttributeSet attrs)
Same as
SettingDateDialogPreference(Context, AttributeSet, int) with
R.attr#uiSettingDateDialogPreferenceStyle as attribute for default style. |
SettingDateDialogPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
Same as
SettingDateDialogPreference(Context, AttributeSet, int, int) with 0 as
default style. |
SettingDateDialogPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
Creates a new instance of SettingInputPreference for the given context.
|
| Modifier and Type | Method and Description |
|---|---|
Date |
getDate()
Like
getDateInMillis(), but this method may be used to check whether the date value
has been specified or not, as this method will return null Date object if there is
no date value specified. |
long |
getDateInMillis()
Returns the preferred date value of this preference.
|
DatePickerDialog.DateOptions |
getDialogOptions()
Dialog options of this preference with the preferred date specified as
DatePickerDialog.DateOptions#date(long), if it is set. |
protected void |
onConfigureDialogOptions(DatePickerDialog.DateOptions 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 DatePickerDialog.DateOptions |
onCreateDialogOptions(android.content.res.Resources resources)
Called to create instance of dialog options specific 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. |
void |
setDate(Date date)
Same as
setDate(long) with milliseconds value of the given date. |
void |
setDate(long dateInMillis)
Sets a preferred date value for this preference.
|
onBindView, onGetDefaultValue, onGetSummaryText, onSetInitialValue, setFormatgetDialogId, 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 SettingDateDialogPreference(android.content.Context context)
SettingDateDialogPreference(Context, AttributeSet) without attributes.public SettingDateDialogPreference(android.content.Context context,
android.util.AttributeSet attrs)
SettingDateDialogPreference(Context, AttributeSet, int) with
R.attr#uiSettingDateDialogPreferenceStyle as attribute for default style.public SettingDateDialogPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
SettingDateDialogPreference(Context, AttributeSet, int, int) with 0 as
default style.public SettingDateDialogPreference(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 DatePickerDialog.DateOptions onCreateDialogOptions(android.content.res.Resources resources)
SettingDialogPreference
Default implementation creates instance of DialogOptions.
onCreateDialogOptions in class SettingDialogPreference<DatePickerDialog.DateOptions>resources - Application resources that may be used supply default values from resources
for the options.protected void onConfigureDialogOptions(DatePickerDialog.DateOptions options,
android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
SettingDialogPreferenceonConfigureDialogOptions in class SettingDialogPreference<DatePickerDialog.DateOptions>options - The options created via SettingDialogPreference.onCreateDialogOptions(Resources).public void setDate(Date date)
setDate(long) with milliseconds value of the given date.date - The desired date with milliseconds value. May be null which corresponds
to 0.getDate()public void setDate(long dateInMillis)
If value of this preference changes, it is persisted and the change listener is notified about the change.
dateInMillis - The preferred date in milliseconds to be persisted.getDateInMillis()public Date getDate()
getDateInMillis(), but this method may be used to check whether the date value
has been specified or not, as this method will return null Date object if there is
no date value specified.null if no date value has been specified yet.setDate(Date),
getDialogOptions()public long getDateInMillis()
setDate(long),
getDialogOptions()public DatePickerDialog.DateOptions getDialogOptions()
DatePickerDialog.DateOptions#date(long), if it is set.getDialogOptions in class SettingDialogPreference<DatePickerDialog.DateOptions>getDateInMillis()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<DatePickerDialog.DateOptions>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.