Slice
class Slice : Parcelable
kotlin.Any | |
↳ | android.app.slice.Slice |
A slice is a piece of app content and actions that can be surfaced outside of the app.
They are constructed using Builder
in a tree structure that provides the OS some information about how the content should be displayed.
Summary
Nested classes | |
---|---|
A Builder used to construct |
Constants | |
---|---|
static String |
Key to retrieve an extra added to an intent when the value of an input range is changed. |
static String |
Key to retrieve an extra added to an intent when a control is changed. |
static String |
Hint that this slice contains a number of actions that can be grouped together in a sort of controls area of the UI. |
static String |
A hint to indicate that this slice represents an error. |
static String |
Hint that list items within this slice or subslice would appear better if organized horizontally. |
static String |
A hint to indicate that the contents of this subslice represent a list of keywords related to the parent slice. |
static String |
Hint that this content is important and should be larger when displayed if possible. |
static String |
Hint indicating an item representing when the content was created or last updated. |
static String |
Hint that all sub-items/sub-slices within this content should be considered to have |
static String |
Hint that this item is part of a list and should be formatted as if is part of a list. |
static String |
Hint to indicate that this content should not be tinted. |
static String |
Hint to indicate that this slice is incomplete and an update will be sent once loading is complete. |
static String |
A hint to indicate that this slice represents a permission request for showing slices. |
static String |
A hint representing that this item should be used to indicate that there's more content associated with this slice. |
static String |
Hint indicating that this item (and its sub-items) are the current selection. |
static String |
Hint to indicate that this content should only be displayed if the slice is presented as a shortcut. |
static String |
Hint indicating this content should be shown instead of the normal content when the slice is in small format. |
static String |
Hint that this content is a title of other content in the slice. |
static String |
Hint indicating an item representing a time-to-live for the content. |
static String |
Subtype to tag an item as representing a color. |
static String |
Subtype to tag an item to use as a content description. |
static String |
Subtype to indicate that this item indicates the layout direction for content in the slice. |
static String |
Subtype to tag an item as representing the max int value for a |
static String |
Subtype to indicate that this is a message as part of a communication sequence in this slice. |
static String |
Subtype to tag an item as representing a time in milliseconds since midnight, January 1, 1970 UTC. |
static String |
Subtype to tag an item representing priority. |
static String |
Subtype to tag an item as representing a range. |
static String |
Subtype to tag the source (i.e. sender) of a |
static String |
Subtype to indicate that this content has a toggle action associated with it. |
static String |
Subtype to tag an item as representing the current int value for a |
Inherited constants | |
---|---|
Protected constructors | |
---|---|
Public methods | |
---|---|
Int | |
MutableList<String!>! |
getHints() |
MutableList<SliceItem!>! |
getItems() |
SliceSpec? |
getSpec() |
Uri! |
getUri() |
Boolean |
Returns whether the caller for this slice matters. |
Unit |
writeToParcel(dest: Parcel, flags: Int) |
Properties | |
---|---|
static Parcelable.Creator<Slice!> |
Constants
EXTRA_RANGE_VALUE
static val EXTRA_RANGE_VALUE: String
Key to retrieve an extra added to an intent when the value of an input range is changed.
Value: "android.app.slice.extra.RANGE_VALUE"
EXTRA_TOGGLE_STATE
static val EXTRA_TOGGLE_STATE: String
Key to retrieve an extra added to an intent when a control is changed.
Value: "android.app.slice.extra.TOGGLE_STATE"
HINT_ACTIONS
static val HINT_ACTIONS: String
Hint that this slice contains a number of actions that can be grouped together in a sort of controls area of the UI.
Value: "actions"
HINT_ERROR
static val HINT_ERROR: String
A hint to indicate that this slice represents an error.
Value: "error"
HINT_HORIZONTAL
static val HINT_HORIZONTAL: String
Hint that list items within this slice or subslice would appear better if organized horizontally.
Value: "horizontal"
HINT_KEYWORDS
static val HINT_KEYWORDS: String
A hint to indicate that the contents of this subslice represent a list of keywords related to the parent slice. Expected to be on an item of format SliceItem#FORMAT_SLICE
.
Value: "keywords"
HINT_LARGE
static val HINT_LARGE: String
Hint that this content is important and should be larger when displayed if possible.
Value: "large"
HINT_LAST_UPDATED
static val HINT_LAST_UPDATED: String
Hint indicating an item representing when the content was created or last updated.
Value: "last_updated"
HINT_LIST
static val HINT_LIST: String
Hint that all sub-items/sub-slices within this content should be considered to have HINT_LIST_ITEM
.
Value: "list"
HINT_LIST_ITEM
static val HINT_LIST_ITEM: String
Hint that this item is part of a list and should be formatted as if is part of a list.
Value: "list_item"
HINT_NO_TINT
static val HINT_NO_TINT: String
Hint to indicate that this content should not be tinted.
Value: "no_tint"
HINT_PARTIAL
static val HINT_PARTIAL: String
Hint to indicate that this slice is incomplete and an update will be sent once loading is complete. Slices which contain HINT_PARTIAL will not be cached by the OS and should not be cached by apps.
Value: "partial"
HINT_PERMISSION_REQUEST
static val HINT_PERMISSION_REQUEST: String
A hint to indicate that this slice represents a permission request for showing slices.
Value: "permission_request"
HINT_SEE_MORE
static val HINT_SEE_MORE: String
A hint representing that this item should be used to indicate that there's more content associated with this slice.
Value: "see_more"
HINT_SELECTED
static val HINT_SELECTED: String
Hint indicating that this item (and its sub-items) are the current selection.
Value: "selected"
HINT_SHORTCUT
static val HINT_SHORTCUT: String
Hint to indicate that this content should only be displayed if the slice is presented as a shortcut.
Value: "shortcut"
HINT_SUMMARY
static val HINT_SUMMARY: String
Hint indicating this content should be shown instead of the normal content when the slice is in small format.
Value: "summary"
HINT_TITLE
static val HINT_TITLE: String
Hint that this content is a title of other content in the slice. This can also indicate that the content should be used in the shortcut representation of the slice (icon, label, action), normally this should be indicated by adding the hint on the action containing that content.
Value: "title"
HINT_TTL
static val HINT_TTL: String
Hint indicating an item representing a time-to-live for the content.
Value: "ttl"
SUBTYPE_COLOR
static val SUBTYPE_COLOR: String
Subtype to tag an item as representing a color. Expected to be on an item of format SliceItem#FORMAT_INT
.
Value: "color"
SUBTYPE_CONTENT_DESCRIPTION
static val SUBTYPE_CONTENT_DESCRIPTION: String
Subtype to tag an item to use as a content description. Expected to be on an item of format SliceItem#FORMAT_TEXT
.
Value: "content_description"
SUBTYPE_LAYOUT_DIRECTION
static val SUBTYPE_LAYOUT_DIRECTION: String
Subtype to indicate that this item indicates the layout direction for content in the slice. Expected to be an item of format SliceItem#FORMAT_INT
.
Value: "layout_direction"
SUBTYPE_MAX
static val SUBTYPE_MAX: String
Subtype to tag an item as representing the max int value for a SUBTYPE_RANGE
. Expected to be on an item of format SliceItem#FORMAT_INT
.
Value: "max"
SUBTYPE_MESSAGE
static val SUBTYPE_MESSAGE: String
Subtype to indicate that this is a message as part of a communication sequence in this slice. Expected to be on an item of format SliceItem#FORMAT_SLICE
.
Value: "message"
SUBTYPE_MILLIS
static val SUBTYPE_MILLIS: String
Subtype to tag an item as representing a time in milliseconds since midnight, January 1, 1970 UTC.
Value: "millis"
SUBTYPE_PRIORITY
static val SUBTYPE_PRIORITY: String
Subtype to tag an item representing priority. Expected to be on an item of format SliceItem#FORMAT_INT
.
Value: "priority"
SUBTYPE_RANGE
static val SUBTYPE_RANGE: String
Subtype to tag an item as representing a range. Expected to be on an item of format SliceItem#FORMAT_SLICE
containing a SUBTYPE_VALUE
and possibly a SUBTYPE_MAX
.
Value: "range"
SUBTYPE_SOURCE
static val SUBTYPE_SOURCE: String
Subtype to tag the source (i.e. sender) of a SUBTYPE_MESSAGE
. Expected to be on an item of format SliceItem#FORMAT_TEXT
, SliceItem#FORMAT_IMAGE
or an SliceItem#FORMAT_SLICE
containing them.
Value: "source"
SUBTYPE_TOGGLE
static val SUBTYPE_TOGGLE: String
Subtype to indicate that this content has a toggle action associated with it. To indicate that the toggle is on, use HINT_SELECTED
. When the toggle state changes, the intent associated with it will be sent along with an extra EXTRA_TOGGLE_STATE
which can be retrieved to see the new state of the toggle.
Value: "toggle"
SUBTYPE_VALUE
static val SUBTYPE_VALUE: String
Subtype to tag an item as representing the current int value for a SUBTYPE_RANGE
. Expected to be on an item of format SliceItem#FORMAT_INT
.
Value: "value"
Protected constructors
Public methods
describeContents
fun describeContents(): Int
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getHints
fun getHints(): MutableList<String!>!
getItems
fun getItems(): MutableList<SliceItem!>!
Return | |
---|---|
MutableList<SliceItem!>! |
All child SliceItem s that this Slice contains. |
getSpec
fun getSpec(): SliceSpec?
Return | |
---|---|
SliceSpec? |
The spec for this slice This value may be null . |
isCallerNeeded
fun isCallerNeeded(): Boolean
Returns whether the caller for this slice matters.
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Parameters | |
---|---|
dest |
Parcel: The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |