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 isActivity()
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

public abstract PendingIntent getAction ()

Returns
PendingIntent the PendingIntent associated with this action.

getContentDescription

public abstract CharSequence getContentDescription ()

Returns
CharSequence the content description to use for this action.

getIcon

public abstract IconCompat getIcon ()

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

getImageMode

public abstract int getImageMode ()

Returns
int the image mode to use for this action.

getPriority

public abstract int getPriority ()

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

getTitle

public abstract CharSequence getTitle ()

Returns
CharSequence the title for this action.

isActivity

public abstract boolean isActivity ()

Returns
boolean whether this activity launches an activity or not.

isChecked

public abstract boolean isChecked ()

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

isDefaultToggle

public abstract boolean isDefaultToggle ()

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

isToggle

public abstract boolean isToggle ()

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

setChecked

public abstract 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

public abstract SliceAction setContentDescription (CharSequence description)

Parameters
description CharSequence: the content description for this action.

Returns
SliceAction

setPriority

public abstract SliceAction setPriority (int priority)

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

Parameters
priority int

Returns
SliceAction