belongs to Maven artifact androidx.slice:slice-core:1.0.0-alpha1

SliceAction

public interface SliceAction

androidx.slice.core.SliceAction


Interface for a slice action, supports tappable icons, custom toggle icons, and default toggles.

Summary

Public methods

abstract PendingIntent getAction()
abstract CharSequence getContentDescription()
abstract IconCompat getIcon()
abstract int getImageMode()
abstract int getPriority()
abstract CharSequence getTitle()
abstract boolean isChecked()
abstract boolean isDefaultToggle()
abstract boolean isToggle()
abstract SliceAction setChecked(boolean isChecked)
abstract SliceAction setContentDescription(CharSequence description)
abstract SliceAction setPriority(int priority)

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

Public methods

getAction

PendingIntent getAction ()

Returns
PendingIntent the PendingIntent associated with this action.

getContentDescription

CharSequence getContentDescription ()

Returns
CharSequence the content description to use for this action.

getIcon

IconCompat getIcon ()

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

getImageMode

int getImageMode ()

Returns
int the image mode to use for this action.

getPriority

int getPriority ()

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

getTitle

CharSequence getTitle ()

Returns
CharSequence the title for this action.

isChecked

boolean isChecked ()

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

isDefaultToggle

boolean isDefaultToggle ()

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

isToggle

boolean isToggle ()

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

setChecked

SliceAction setChecked (boolean isChecked)

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

Returns
SliceAction

setContentDescription

SliceAction setContentDescription (CharSequence description)

Parameters
description CharSequence: the content description for this action.

Returns
SliceAction

setPriority

SliceAction setPriority (int priority)

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

Parameters
priority int

Returns
SliceAction