added in version 1.0.0
belongs to Maven artifact androidx.leanback:leanback:1.0.0-beta01

GuidedDatePickerAction

public class GuidedDatePickerAction
extends GuidedAction

java.lang.Object
   ↳ androidx.leanback.widget.Action
     ↳ androidx.leanback.widget.GuidedAction
       ↳ androidx.leanback.widget.GuidedDatePickerAction


Subclass of GuidedAction that can choose a date. The Action is editable by default; to make it read only, call hasEditableActivatorView(false) on the Builder.

Summary

Nested classes

class GuidedDatePickerAction.Builder

Builder class to build a GuidedDatePickerAction. 

class GuidedDatePickerAction.BuilderBase<B extends BuilderBase>

Base Builder class to build GuidedDatePickerAction. 

Inherited constants

Public constructors

GuidedDatePickerAction()

Public methods

long getDate()

Get current value of DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

String getDatePickerFormat()

Returns format of date Picker or null if not specified.

long getMaxDate()

Get maximum value of DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

long getMinDate()

Get minimal value of DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

void onRestoreInstanceState(Bundle bundle, String key)

Restore action from a bundle using a given key.

void onSaveInstanceState(Bundle bundle, String key)

Save action into a bundle using a given key.

void setDate(long date)

Sets current value of DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

Inherited methods

Public constructors

GuidedDatePickerAction

added in version 1.0.0
public GuidedDatePickerAction ()

Public methods

getDate

added in version 1.0.0
public long getDate ()

Get current value of DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

Returns
long Current value of DatePicker Action.

getDatePickerFormat

added in version 1.0.0
public String getDatePickerFormat ()

Returns format of date Picker or null if not specified. The format is a case insensitive String containing the * day ('d'), month ('m'), and year ('y'). When the format is not specified, a default format of current locale will be used.

Returns
String Format of showing Date, e.g. "YMD". Returns null if using current locale's default.

getMaxDate

added in version 1.0.0
public long getMaxDate ()

Get maximum value of DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

Returns
long Maximum value of DatePicker Action or Long.MAX_VALUE if not set.

getMinDate

added in version 1.0.0
public long getMinDate ()

Get minimal value of DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone. -1 if not set.

Returns
long Minimal value of DatePicker Action or Long.MIN_VALUE if not set.

onRestoreInstanceState

added in version 1.0.0
public void onRestoreInstanceState (Bundle bundle, 
                String key)

Restore action from a bundle using a given key. When isAutoRestore() is true:

  • isEditable() is true: save text of getTitle()
  • isDescriptionEditable() is true: save text of getDescription()
  • getCheckSetId() is not NO_CHECK_SET: save isChecked()}
  • GuidedDatePickerAction will be saved
  • Subclass may override this method.

    Parameters
    bundle Bundle: Bundle to restore the Action from.

    key String: Key used to restore the Action.

    onSaveInstanceState

    added in version 1.0.0
    public void onSaveInstanceState (Bundle bundle, 
                    String key)

    Save action into a bundle using a given key. When isAutoRestoreEna() is true:

  • isEditable() is true: save text of getTitle()
  • isDescriptionEditable() is true: save text of getDescription()
  • getCheckSetId() is not NO_CHECK_SET: save isChecked()}
  • GuidedDatePickerAction will be saved
  • Subclass may override this method.

    Parameters
    bundle Bundle: Bundle to save the Action.

    key String: Key used to save the Action.

    setDate

    added in version 1.0.0
    public void setDate (long date)

    Sets current value of DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

    Parameters
    date long: New value to update current value of DatePicker Action.