|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object android.preference.Preference android.preference.DialogPreference org.bostonandroid.datepreference.DatePreference
public class DatePreference
Nested Class Summary |
---|
Nested classes/interfaces inherited from class android.preference.Preference |
---|
android.preference.Preference.BaseSavedState, android.preference.Preference.OnPreferenceChangeListener, android.preference.Preference.OnPreferenceClickListener |
Field Summary |
---|
Fields inherited from class android.preference.Preference |
---|
DEFAULT_ORDER |
Constructor Summary | |
---|---|
DatePreference(android.content.Context context,
android.util.AttributeSet attrs)
|
|
DatePreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
|
Method Summary | |
---|---|
static java.util.Calendar |
defaultCalendar()
The default date to use when the XML does not set it or the XML has an error. |
static java.lang.String |
defaultCalendarString()
The defaultCalendar() as a string using the formatter() . |
static java.text.SimpleDateFormat |
formatter()
Produces the date formatter used for dates in the XML. |
java.util.Calendar |
getDate()
Produces the date used for the date picker. |
static java.util.Calendar |
getDateFor(android.content.SharedPreferences preferences,
java.lang.String field)
Produces the date the user has selected for the given preference, as a calendar. |
void |
onClick(android.content.DialogInterface dialog,
int which)
Called whenever the user clicks on a button. |
protected android.view.View |
onCreateDialogView()
Produces a DatePicker set to the date produced by getDate() . |
void |
onDateChanged(android.widget.DatePicker view,
int year,
int month,
int day)
Called when the user changes the date. |
protected void |
onDialogClosed(boolean shouldSave)
Called when the dialog is closed. |
protected java.lang.Object |
onGetDefaultValue(android.content.res.TypedArray a,
int index)
|
protected void |
onRestoreInstanceState(android.os.Parcelable state)
Called when Android restores the activity. |
protected android.os.Parcelable |
onSaveInstanceState()
Called when Android pauses the activity. |
protected void |
onSetInitialValue(boolean restoreValue,
java.lang.Object def)
Called when the date picker is shown or restored. |
void |
setDate(java.lang.String dateString)
Set the selected date to the specified string. |
static java.text.SimpleDateFormat |
summaryFormatter()
Produces the date formatter used for showing the date in the summary. |
Methods inherited from class android.preference.DialogPreference |
---|
getDialog, getDialogIcon, getDialogLayoutResource, getDialogMessage, getDialogTitle, getNegativeButtonText, getPositiveButtonText, onActivityDestroy, onBindDialogView, onClick, onDismiss, onPrepareDialogBuilder, setDialogIcon, setDialogIcon, setDialogLayoutResource, setDialogMessage, setDialogMessage, setDialogTitle, setDialogTitle, setNegativeButtonText, setNegativeButtonText, setPositiveButtonText, setPositiveButtonText, showDialog |
Methods inherited from class android.preference.Preference |
---|
callChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getEditor, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPreferenceManager, getSharedPreferences, getShouldDisableView, getSummary, getTitle, getView, getWidgetLayoutResource, hasKey, isEnabled, isPersistent, isSelectable, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToActivity, onAttachedToHierarchy, onBindView, onCreateView, onDependencyChanged, onPrepareForRemoval, persistBoolean, persistFloat, persistInt, persistLong, persistString, restoreHierarchyState, saveHierarchyState, setDefaultValue, setDependency, setEnabled, setIntent, setKey, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setSelectable, setShouldDisableView, setSummary, setSummary, setTitle, setTitle, setWidgetLayoutResource, shouldCommit, shouldDisableDependents, shouldPersist, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DatePreference(android.content.Context context, android.util.AttributeSet attrs, int defStyle)
public DatePreference(android.content.Context context, android.util.AttributeSet attrs)
Method Detail |
---|
protected android.view.View onCreateDialogView()
getDate()
. When
overriding be sure to call the super.
onCreateDialogView
in class android.preference.DialogPreference
public java.util.Calendar getDate()
defaultCalendar()
.
public void setDate(java.lang.String dateString)
dateString
- The date, represented as a string, in the format specified by
formatter()
.public static java.text.SimpleDateFormat formatter()
public static java.text.SimpleDateFormat summaryFormatter()
protected java.lang.Object onGetDefaultValue(android.content.res.TypedArray a, int index)
onGetDefaultValue
in class android.preference.Preference
protected void onSetInitialValue(boolean restoreValue, java.lang.Object def)
onSetInitialValue
in class android.preference.Preference
protected android.os.Parcelable onSaveInstanceState()
onSaveInstanceState
in class android.preference.DialogPreference
protected void onRestoreInstanceState(android.os.Parcelable state)
onRestoreInstanceState
in class android.preference.DialogPreference
public void onDateChanged(android.widget.DatePicker view, int year, int month, int day)
onDateChanged
in interface android.widget.DatePicker.OnDateChangedListener
protected void onDialogClosed(boolean shouldSave)
onDialogClosed
in class android.preference.DialogPreference
public static java.util.Calendar defaultCalendar()
public static java.lang.String defaultCalendarString()
formatter()
.
public void onClick(android.content.DialogInterface dialog, int which)
onDateChanged(DatePicker, int, int, int)
and onDialogClosed(boolean)
. Be sure to call the super when overriding.
onClick
in interface android.content.DialogInterface.OnClickListener
onClick
in class android.preference.DialogPreference
public static java.util.Calendar getDateFor(android.content.SharedPreferences preferences, java.lang.String field)
preferences
- the SharedPreferences to get the date fromfield
- the name of the preference to get the date from
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |