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.

@Nullable 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 @Nullable Drawable

Returns the icon drawable for this Action.

final long

Returns the id for this Action.

final @Nullable CharSequence

Returns the first line label for this Action.

final @Nullable 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.

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

Returns autofill hints, see setAutofillHints.

int

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

@Nullable 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.

@Nullable CharSequence

Returns the optional description text to edit.

int

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

@Nullable CharSequence

Returns the optional title text to edit.

int

Returns InputType of action title not in editing.

@Nullable Intent

Returns the intent associated with this action.

@Nullable List<GuidedAction>
@Nullable 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

Sets the intent of this action.

void

Change sub actions list.

void

Sets the title of this action.

Public constructors

GuidedDatePickerAction

Added in 1.1.0
public GuidedDatePickerAction()

Public methods

getDate

Added in 1.1.0
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

Added in 1.1.0
public @Nullable 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
@Nullable String

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

getMaxDate

Added in 1.1.0
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

Added in 1.1.0
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(@NonNull Bundle bundle, @Nullable String key)

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

Subclass may override this method.
Parameters
@NonNull Bundle bundle

Bundle to restore the Action from.

@Nullable String key

Key used to restore the Action.

onSaveInstanceState

public void onSaveInstanceState(@NonNull Bundle bundle, @Nullable String key)

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

Subclass may override this method.
Parameters
@NonNull Bundle bundle

Bundle to save the Action.

@Nullable String key

Key used to save the Action.

setDate

Added in 1.1.0
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.