SliceItem
class SliceItem : CustomVersionedParcelable
androidx.slice.SliceItem |
A SliceItem is a single unit in the tree structure of a Slice
.
A SliceItem a piece of content and some hints about what that content means or how it should be displayed. The types of content can be:
android.app.slice.SliceItem#FORMAT_SLICE
android.app.slice.SliceItem#FORMAT_TEXT
android.app.slice.SliceItem#FORMAT_IMAGE
android.app.slice.SliceItem#FORMAT_ACTION
android.app.slice.SliceItem#FORMAT_INT
android.app.slice.SliceItem#FORMAT_LONG
The hints that a SliceItem
are a set of strings which annotate the content. The hints that are guaranteed to be understood by the system are defined on Slice
.
Summary
Public methods |
|
---|---|
static ParcelableSpan |
Creates a span object that identifies content that should be redacted when acquired using |
Unit |
fireAction(@Nullable context: Context?, @Nullable i: Intent?) Trigger the action on this SliceItem. |
PendingIntent! | |
String! |
Get the format of this SliceItem. |
MutableList<String!> |
getHints() Gets all hints associated with this SliceItem. |
IconCompat! |
getIcon() |
Int |
getInt() |
Long |
getLong() |
CharSequence? |
Get the same content as |
Slice! |
getSlice() |
String! |
Get the sub-type of this SliceItem. |
CharSequence! |
getText() |
Boolean | |
Unit | |
Unit |
onPreParceling(isStream: Boolean) |
String |
toString() |
Public methods
createSensitiveSpan
@NonNull static fun createSensitiveSpan(): ParcelableSpan
Creates a span object that identifies content that should be redacted when acquired using getRedactedText()
.
fireAction
fun fireAction(@Nullable context: Context?, @Nullable i: Intent?): Unit
Trigger the action on this SliceItem.
Parameters | |
---|---|
context |
Context?: The Context to use when sending the PendingIntent. |
i |
Context?: The intent to use when sending the PendingIntent. |
getAction
fun getAction(): PendingIntent!
Return | |
---|---|
PendingIntent!: The pending intent held by this android.app.slice.SliceItem#FORMAT_ACTION SliceItem |
getFormat
fun getFormat(): String!
Get the format of this SliceItem.
The format will be one of the following types supported by the platform:
android.app.slice.SliceItem#FORMAT_SLICE
android.app.slice.SliceItem#FORMAT_TEXT
android.app.slice.SliceItem#FORMAT_IMAGE
android.app.slice.SliceItem#FORMAT_ACTION
android.app.slice.SliceItem#FORMAT_INT
android.app.slice.SliceItem#FORMAT_LONG
android.app.slice.SliceItem#FORMAT_REMOTE_INPUT
See Also
getHints
@NonNull fun getHints(): MutableList<String!>
Gets all hints associated with this SliceItem.
Return | |
---|---|
MutableList<String!>: Array of hints. |
getIcon
fun getIcon(): IconCompat!
Return | |
---|---|
IconCompat!: The icon held by this android.app.slice.SliceItem#FORMAT_IMAGE SliceItem |
getInt
fun getInt(): Int
Return | |
---|---|
Int: The color held by this android.app.slice.SliceItem#FORMAT_INT SliceItem |
getLong
fun getLong(): Long
Return | |
---|---|
Long: The long held by this android.app.slice.SliceItem#FORMAT_LONG SliceItem |
getRedactedText
@Nullable fun getRedactedText(): CharSequence?
Get the same content as getText()
except with content that should be excluded from persistent logs because it was tagged with createSensitiveSpan()
.
Return | |
---|---|
CharSequence?: The text held by this android.app.slice.SliceItem#FORMAT_TEXT SliceItem |
getSlice
fun getSlice(): Slice!
Return | |
---|---|
Slice!: The slice held by this android.app.slice.SliceItem#FORMAT_ACTION or android.app.slice.SliceItem#FORMAT_SLICE SliceItem |
getSubType
fun getSubType(): String!
Get the sub-type of this SliceItem.
Subtypes provide additional information about the type of this information beyond basic interpretations inferred by getFormat()
. For example a slice may contain many android.app.slice.SliceItem#FORMAT_TEXT
items, but only some of them may be android.app.slice.Slice#SUBTYPE_MESSAGE
.
See Also
getText
fun getText(): CharSequence!
Return | |
---|---|
CharSequence!: The text held by this android.app.slice.SliceItem#FORMAT_TEXT SliceItem |
hasHint
fun hasHint(hint: String!): Boolean
Parameters | |
---|---|
hint |
String!: The hint to check for |
Return | |
---|---|
Boolean: true if this item contains the given hint |
onPostParceling
fun onPostParceling(): Unit