SliceAction
public
class
SliceAction
extends Object
implements
SliceAction
java.lang.Object
|
↳ |
androidx.slice.builders.SliceAction
|
Class representing an action, supports tappable icons, custom toggle icons, and default
toggles, as well as date and time pickers.
Summary
Public methods |
static
SliceAction
|
create(PendingIntent action, IconCompat actionIcon, int imageMode, CharSequence actionTitle)
Construct a SliceAction representing a tappable icon.
|
static
SliceAction
|
create(RemoteCallback action, IconCompat actionIcon, int imageMode, CharSequence actionTitle)
Construct a SliceAction representing a tappable icon.
|
static
SliceAction
|
createDeeplink(RemoteCallback action, IconCompat actionIcon, int imageMode, CharSequence actionTitle)
Construct a SliceAction representing a tappable icon that launches an
activity when clicked.
|
static
SliceAction
|
createDeeplink(PendingIntent action, IconCompat actionIcon, int imageMode, CharSequence actionTitle)
Construct a SliceAction representing a tappable icon that launches an
activity when clicked.
|
static
SliceAction
|
createToggle(RemoteCallback action, IconCompat actionIcon, CharSequence actionTitle, boolean isChecked)
Construct a SliceAction representing a custom toggle icon.
|
static
SliceAction
|
createToggle(RemoteCallback action, CharSequence actionTitle, boolean isChecked)
Construct a SliceAction representing a default toggle.
|
static
SliceAction
|
createToggle(PendingIntent action, IconCompat actionIcon, CharSequence actionTitle, boolean isChecked)
Construct a SliceAction representing a custom toggle icon.
|
static
SliceAction
|
createToggle(PendingIntent action, CharSequence actionTitle, boolean isChecked)
Construct a SliceAction representing a default toggle.
|
PendingIntent
|
getAction()
|
CharSequence
|
getContentDescription()
|
IconCompat
|
getIcon()
|
int
|
getImageMode()
|
int
|
getPriority()
|
CharSequence
|
getTitle()
|
boolean
|
isActivity()
|
boolean
|
isChecked()
|
boolean
|
isDefaultToggle()
|
boolean
|
isToggle()
|
SliceAction
|
setChecked(boolean isChecked)
|
SliceAction
|
setContentDescription(CharSequence description)
|
SliceAction
|
setPriority(int priority)
Sets the priority of this action, with the lowest priority having the highest ranking.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
|
Public methods
create
public static SliceAction create (PendingIntent action,
IconCompat actionIcon,
int imageMode,
CharSequence actionTitle)
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(CharSequence) . |
create
public static SliceAction create (RemoteCallback action,
IconCompat actionIcon,
int imageMode,
CharSequence actionTitle)
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(CharSequence) . |
createDeeplink
public static SliceAction createDeeplink (RemoteCallback action,
IconCompat actionIcon,
int imageMode,
CharSequence actionTitle)
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(CharSequence) . |
createDeeplink
public static SliceAction createDeeplink (PendingIntent action,
IconCompat actionIcon,
int imageMode,
CharSequence actionTitle)
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(CharSequence) . |
createToggle
public static SliceAction createToggle (RemoteCallback action,
IconCompat actionIcon,
CharSequence actionTitle,
boolean isChecked)
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(CharSequence) . |
isChecked |
boolean : the state of the toggle.
|
createToggle
public static SliceAction createToggle (RemoteCallback action,
CharSequence actionTitle,
boolean isChecked)
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(CharSequence) . |
isChecked |
boolean : the state of the toggle.
|
createToggle
public static SliceAction createToggle (PendingIntent action,
IconCompat actionIcon,
CharSequence actionTitle,
boolean isChecked)
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(CharSequence) . |
isChecked |
boolean : the state of the toggle.
|
createToggle
public static SliceAction createToggle (PendingIntent action,
CharSequence actionTitle,
boolean isChecked)
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(CharSequence) . |
isChecked |
boolean : the state of the toggle.
|
getContentDescription
public CharSequence getContentDescription ()
Returns |
CharSequence |
the content description to use for this action.
|
getIcon
public IconCompat getIcon ()
Returns |
IconCompat |
the Icon to display for this action. This can be null when the action
represented is a default toggle.
|
getImageMode
public int getImageMode ()
Returns |
int |
the image mode to use for this action.
|
getPriority
public int getPriority ()
Returns |
int |
the priority associated with this action, -1 if unset.
|
getTitle
public CharSequence getTitle ()
Returns |
CharSequence |
the title for this action.
|
isActivity
public boolean isActivity ()
isChecked
public boolean isChecked ()
Returns |
boolean |
whether the state of this action is checked or not; only used for toggle actions.
|
isDefaultToggle
public boolean isDefaultToggle ()
Returns |
boolean |
whether this action is a toggle using the standard switch control.
|
isToggle
public boolean isToggle ()
Returns |
boolean |
whether this action represents a toggle (i.e. has a checked and unchecked state).
|
setChecked
public SliceAction setChecked (boolean isChecked)
Parameters |
isChecked |
boolean : whether the state of this action is checked or not; only used for toggle
actions.
|
setContentDescription
public SliceAction setContentDescription (CharSequence description)
Parameters |
description |
CharSequence : the content description for this action.
|
setPriority
public SliceAction setPriority (int priority)
Sets the priority of this action, with the lowest priority having the highest ranking.