Stay organized with collections Save and categorize content based on your preferences.

GuidedDatePickerAction

public class GuidedDatePickerAction extends GuidedAction


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 types

Builder class to build a GuidedDatePickerAction.

Base Builder class to build GuidedDatePickerAction.

Public constructors

Public methods

long

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

String

Returns format of date Picker or null if not specified.

long

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

long

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

void

Restore action from a bundle using a given key.

void

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 getDefault time zone.

Inherited Constants

From androidx.leanback.widget.Action
static final long
NO_ID = -1

Indicates that an id has not been set.

From androidx.leanback.widget.GuidedAction
static final long

Id of standard Cancel action.

static final long

Id of standard Finish action.

static final long

When finishing editing, stay on current action.

static final long

Id of standard Finish action.

static final long

When finishing editing, goes to next action.

static final long

Id of standard No action.

static final long

Id of standard OK action.

static final long

Id of standard Yes action.

static final int

Checkset Id for checkbox.

static final int

Default checkset Id for radio.

static final int

Special check set Id that is neither checkbox nor radio.

Inherited methods

From androidx.leanback.widget.Action
final void
addKeyCode(int keyCode)

Adds a keycode used to invoke this Action.

final Drawable

Returns the icon drawable for this Action.

final long

Returns the id for this Action.

final CharSequence

Returns the first line label for this Action.

final CharSequence

Returns the second line label for this Action.

final void
removeKeyCode(int keyCode)

Removes a keycode used to invoke this Action.

final boolean
respondsToKeyCode(int keyCode)

Returns true if the Action should respond to the given keycode.

final void

Sets the icon drawable for this Action.

final void
setId(long id)

Sets the id for this Action.

final void

Sets the first line label for this Action.

final void

Sets the second line label for this Action.

String
From androidx.leanback.widget.GuidedAction
String[]

Returns autofill hints, see setAutofillHints.

int

Returns the check set id this action is a part of.

CharSequence

Returns the description of this action.

int

Returns InputType of action description in editing; only valid when isDescriptionEditable is true.

int

Returns InputType of action description not in editing.

CharSequence

Returns the optional description text to edit.

int

Returns InputType of action title in editing; only valid when isEditable is true.

CharSequence

Returns the optional title text to edit.

int

Returns InputType of action title not in editing.

Intent

Returns the intent associated with this action.

List<GuidedAction>
CharSequence

Returns the title of this action.

boolean

Returns whether this action can be activated to edit, e.g. a DatePicker.

boolean

Returns whether this action is has a multiline description.

boolean

Returns whether this action will request further user input when selected, such as showing another GuidedStepFragment or launching a new activity.

boolean
boolean

Returns if this action has editable title or editable description.

boolean

Returns whether the action will only display information and is thus not clickable.

final boolean

Returns true if Action will be saved to instanceState and restored later, false otherwise.

boolean

Returns whether this action is checked.

boolean

Returns whether this action description is editable.

boolean

Returns true if getEditTitle is not null.

boolean

Returns whether this action title is editable.

boolean

Returns whether this action is enabled.

boolean

Returns whether this action is focusable.

void
setChecked(boolean checked)

Sets whether this action is checked.

void

Sets the description of this action.

void

Sets the optional description text to edit instead of setDescription.

void

Sets the optional title text to edit instead of setTitle.

void
setEnabled(boolean enabled)

Sets whether this action is enabled.

void
setFocusable(boolean focusable)

Sets whether this action is focusable.

void
setIntent(Intent intent)

Sets the intent of this action.

void

Change sub actions list.

void

Sets the title of this action.

Public constructors

GuidedDatePickerAction

public GuidedDatePickerAction()

Public methods

getDate

public long getDate()

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

Returns
long

Current value of DatePicker Action.

getDatePickerFormat

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

public long getMaxDate()

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

Returns
long

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

getMinDate

public long getMinDate()

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

Returns
long

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

onRestoreInstanceState

public void onRestoreInstanceState(Bundle bundle, String key)

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

Subclass may override this method.
Parameters
Bundle bundle

Bundle to restore the Action from.

String key

Key used to restore the Action.

onSaveInstanceState

public void onSaveInstanceState(Bundle bundle, String key)

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

Subclass may override this method.
Parameters
Bundle bundle

Bundle to save the Action.

String key

Key used to save the Action.

setDate

public void setDate(long date)

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

Parameters
long date

New value to update current value of DatePicker Action.