@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(
    action: PendingIntent,
    actionIcon: IconCompat,
    imageMode: Int,
    actionTitle: CharSequence
)

Construct a SliceAction representing a tappable icon.

java-static SliceAction!
create(
    action: RemoteCallback,
    actionIcon: IconCompat,
    imageMode: Int,
    actionTitle: CharSequence
)

Construct a SliceAction representing a tappable icon.

java-static SliceAction!
createDeeplink(
    action: PendingIntent,
    actionIcon: IconCompat,
    imageMode: Int,
    actionTitle: CharSequence
)

Construct a SliceAction representing a tappable icon that launches an activity when clicked.

java-static SliceAction!
createDeeplink(
    action: RemoteCallback,
    actionIcon: IconCompat,
    imageMode: Int,
    actionTitle: CharSequence
)

Construct a SliceAction representing a tappable icon that launches an activity when clicked.

java-static SliceAction!
createToggle(
    action: PendingIntent,
    actionTitle: CharSequence,
    isChecked: Boolean
)

Construct a SliceAction representing a default toggle.

java-static SliceAction!
createToggle(
    action: RemoteCallback,
    actionTitle: CharSequence,
    isChecked: Boolean
)

Construct a SliceAction representing a default toggle.

java-static SliceAction!
createToggle(
    action: PendingIntent,
    actionIcon: IconCompat,
    actionTitle: CharSequence,
    isChecked: Boolean
)

Construct a SliceAction representing a custom toggle icon.

java-static SliceAction!
createToggle(
    action: RemoteCallback,
    actionIcon: IconCompat,
    actionTitle: CharSequence,
    isChecked: Boolean
)

Construct a SliceAction representing a custom toggle icon.

PendingIntent
CharSequence?
IconCompat?
Int
Int
CharSequence
Boolean
Boolean
Boolean
Boolean
SliceAction
setChecked(isChecked: Boolean)
SliceAction
SliceAction
setPriority(priority: @IntRange(from = 0) Int)

Sets the priority of this action, with the lowest priority having the highest ranking.

Public functions

create

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

create

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

createDeeplink

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

createDeeplink

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

createToggle

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

isChecked: Boolean

the state of the toggle.

createToggle

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

isChecked: Boolean

the state of the toggle.

createToggle

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

isChecked: Boolean

the state of the toggle.

createToggle

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

isChecked: Boolean

the state of the toggle.

getAction

Added in 1.1.0-alpha02
fun getAction(): PendingIntent
Returns
PendingIntent

the PendingIntent associated with this action.

getContentDescription

Added in 1.1.0-alpha02
fun getContentDescription(): CharSequence?
Returns
CharSequence?

the content description to use for this action.

getIcon

Added in 1.1.0-alpha02
fun getIcon(): IconCompat?
Returns
IconCompat?

the Icon to display for this action. This can be null when the action represented is a default toggle.

getImageMode

Added in 1.1.0-alpha02
fun getImageMode(): Int
Returns
Int

the image mode to use for this action.

getPriority

Added in 1.1.0-alpha02
fun getPriority(): Int
Returns
Int

the priority associated with this action, -1 if unset.

getTitle

Added in 1.1.0-alpha02
fun getTitle(): CharSequence
Returns
CharSequence

the title for this action.

isActivity

Added in 1.1.0-alpha02
fun isActivity(): Boolean
Returns
Boolean

whether this activity launches an activity or not.

isChecked

Added in 1.1.0-alpha02
fun isChecked(): Boolean
Returns
Boolean

whether the state of this action is checked or not; only used for toggle actions.

isDefaultToggle

Added in 1.1.0-alpha02
fun isDefaultToggle(): Boolean
Returns
Boolean

whether this action is a toggle using the standard switch control.

isToggle

Added in 1.1.0-alpha02
fun isToggle(): Boolean
Returns
Boolean

whether this action represents a toggle (i.e. has a checked and unchecked state).

setChecked

Added in 1.1.0-alpha02
fun setChecked(isChecked: Boolean): SliceAction
Parameters
isChecked: Boolean

whether the state of this action is checked or not; only used for toggle actions.

setContentDescription

Added in 1.1.0-alpha02
fun setContentDescription(description: CharSequence): SliceAction
Parameters
description: CharSequence

the content description for this action.

setPriority

Added in 1.1.0-alpha02
fun setPriority(priority: @IntRange(from = 0) Int): SliceAction

Sets the priority of this action, with the lowest priority having the highest ranking.