SliceAction
@RequiresApi(value = 19)
class SliceAction : SliceAction
Class representing an action, supports tappable icons, custom toggle icons, and default toggles, as well as date and time pickers.
Summary
Public functions |
|
|---|---|
java-static SliceAction! |
create(Construct a SliceAction representing a tappable icon. |
java-static SliceAction! |
create(Construct a SliceAction representing a tappable icon. |
java-static SliceAction! |
createDeeplink(Construct a SliceAction representing a tappable icon that launches an activity when clicked. |
java-static SliceAction! |
createDeeplink(Construct a SliceAction representing a tappable icon that launches an activity when clicked. |
java-static SliceAction! |
createToggle(Construct a SliceAction representing a default toggle. |
java-static SliceAction! |
createToggle(Construct a SliceAction representing a default toggle. |
java-static SliceAction! |
createToggle(Construct a SliceAction representing a custom toggle icon. |
java-static SliceAction! |
createToggle(Construct a SliceAction representing a custom toggle icon. |
PendingIntent |
|
CharSequence? |
|
IconCompat? |
getIcon() |
Int |
|
Int |
|
CharSequence |
getTitle() |
Boolean |
|
Boolean |
|
Boolean |
|
Boolean |
isToggle() |
SliceAction |
setChecked(isChecked: Boolean) |
SliceAction |
setContentDescription(description: CharSequence) |
SliceAction |
setPriority(priority: @IntRange(from = 0) Int)Sets the priority of this action, with the lowest priority having the highest ranking. |
Public functions
create
java-static fun create(
action: PendingIntent,
actionIcon: IconCompat,
imageMode: Int,
actionTitle: CharSequence
): SliceAction!
Construct a SliceAction representing a tappable icon.
| Parameters | |
|---|---|
action: PendingIntent |
the pending intent to invoke for this action. |
actionIcon: IconCompat |
the icon to display for this action. |
imageMode: Int |
the mode this icon should be displayed in. |
actionTitle: CharSequence |
the title for this action, also used for content description if one hasn't been set via |
| See also | |
|---|---|
ICON_IMAGE |
|
SMALL_IMAGE |
|
LARGE_IMAGE |
create
java-static fun create(
action: RemoteCallback,
actionIcon: IconCompat,
imageMode: Int,
actionTitle: CharSequence
): SliceAction!
Construct a SliceAction representing a tappable icon.
| Parameters | |
|---|---|
action: RemoteCallback |
the remote callback to invoke for this action. |
actionIcon: IconCompat |
the icon to display for this action. |
imageMode: Int |
the mode this icon should be displayed in. |
actionTitle: CharSequence |
the title for this action, also used for content description if one hasn't been set via |
| See also | |
|---|---|
ICON_IMAGE |
|
SMALL_IMAGE |
|
LARGE_IMAGE |
createDeeplink
java-static fun createDeeplink(
action: PendingIntent,
actionIcon: IconCompat,
imageMode: Int,
actionTitle: CharSequence
): SliceAction!
Construct a SliceAction representing a tappable icon that launches an activity when clicked.
| Parameters | |
|---|---|
action: PendingIntent |
the pending intent to invoke for this action. |
actionIcon: IconCompat |
the icon to display for this action. |
imageMode: Int |
the mode this icon should be displayed in. |
actionTitle: CharSequence |
the title for this action, also used for content description if one hasn't been set via |
| See also | |
|---|---|
ICON_IMAGE |
|
SMALL_IMAGE |
|
LARGE_IMAGE |
createDeeplink
java-static fun createDeeplink(
action: RemoteCallback,
actionIcon: IconCompat,
imageMode: Int,
actionTitle: CharSequence
): SliceAction!
Construct a SliceAction representing a tappable icon that launches an activity when clicked.
| Parameters | |
|---|---|
action: RemoteCallback |
the remote callback to invoke for this action. |
actionIcon: IconCompat |
the icon to display for this action. |
imageMode: Int |
the mode this icon should be displayed in. |
actionTitle: CharSequence |
the title for this action, also used for content description if one hasn't been set via |
| See also | |
|---|---|
ICON_IMAGE |
|
SMALL_IMAGE |
|
LARGE_IMAGE |
createToggle
java-static fun createToggle(
action: PendingIntent,
actionTitle: CharSequence,
isChecked: Boolean
): SliceAction!
Construct a SliceAction representing a default toggle.
| Parameters | |
|---|---|
action: PendingIntent |
the pending intent to invoke for this toggle. |
actionTitle: CharSequence |
the title for this toggle, also used for content description if one hasn't been set via |
isChecked: Boolean |
the state of the toggle. |
createToggle
java-static fun createToggle(
action: RemoteCallback,
actionTitle: CharSequence,
isChecked: Boolean
): SliceAction!
Construct a SliceAction representing a default toggle.
| Parameters | |
|---|---|
action: RemoteCallback |
the remote callback to invoke for this toggle. |
actionTitle: CharSequence |
the title for this toggle, also used for content description if one hasn't been set via |
isChecked: Boolean |
the state of the toggle. |
createToggle
java-static fun createToggle(
action: PendingIntent,
actionIcon: IconCompat,
actionTitle: CharSequence,
isChecked: Boolean
): SliceAction!
Construct a SliceAction representing a custom toggle icon.
| Parameters | |
|---|---|
action: PendingIntent |
the pending intent to invoke for this toggle. |
actionIcon: IconCompat |
the icon to display for this toggle, should have a checked and unchecked state. |
actionTitle: CharSequence |
the title for this toggle, also used for content description if one hasn't been set via |
isChecked: Boolean |
the state of the toggle. |
createToggle
java-static fun createToggle(
action: RemoteCallback,
actionIcon: IconCompat,
actionTitle: CharSequence,
isChecked: Boolean
): SliceAction!
Construct a SliceAction representing a custom toggle icon.
| Parameters | |
|---|---|
action: RemoteCallback |
the remote callback to invoke for this toggle. |
actionIcon: IconCompat |
the icon to display for this toggle, should have a checked and unchecked state. |
actionTitle: CharSequence |
the title for this toggle, also used for content description if one hasn't been set via |
isChecked: Boolean |
the state of the toggle. |
getAction
fun getAction(): PendingIntent
| Returns | |
|---|---|
PendingIntent |
the |
getContentDescription
fun getContentDescription(): CharSequence?
| Returns | |
|---|---|
CharSequence? |
the content description to use for this action. |
getIcon
fun getIcon(): IconCompat?
| Returns | |
|---|---|
IconCompat? |
the |
getImageMode
fun getImageMode(): Int
| Returns | |
|---|---|
Int |
the image mode to use for this action. |
getPriority
fun getPriority(): Int
| Returns | |
|---|---|
Int |
the priority associated with this action, -1 if unset. |
getTitle
fun getTitle(): CharSequence
| Returns | |
|---|---|
CharSequence |
the title for this action. |
isActivity
fun isActivity(): Boolean
| Returns | |
|---|---|
Boolean |
whether this activity launches an activity or not. |
isChecked
fun isChecked(): Boolean
| Returns | |
|---|---|
Boolean |
whether the state of this action is checked or not; only used for toggle actions. |
isDefaultToggle
fun isDefaultToggle(): Boolean
| Returns | |
|---|---|
Boolean |
whether this action is a toggle using the standard switch control. |
isToggle
fun isToggle(): Boolean
| Returns | |
|---|---|
Boolean |
whether this action represents a toggle (i.e. has a checked and unchecked state). |
setChecked
fun setChecked(isChecked: Boolean): SliceAction
| Parameters | |
|---|---|
isChecked: Boolean |
whether the state of this action is checked or not; only used for toggle actions. |
setContentDescription
fun setContentDescription(description: CharSequence): SliceAction
| Parameters | |
|---|---|
description: CharSequence |
the content description for this action. |
setPriority
fun setPriority(priority: @IntRange(from = 0) Int): SliceAction
Sets the priority of this action, with the lowest priority having the highest ranking.