ShortcutSpec

open class ShortcutSpec

Describes one shortcut inside a shortcuts block.

At least one intent is required. When several intents are added, they form the activity back stack: the last intent is the one launched, and the preceding ones are what the back button walks through.

Inheritors

Properties

Link copied to clipboard

Launcher categories, e.g. ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION.

Link copied to clipboard

Message shown when the user taps this shortcut while it is disabled.

Link copied to clipboard

Icon from a drawable resource. Ignored when icon or adaptiveIcon is also called.

Link copied to clipboard
val id: String

The stable identity of the shortcut.

Link copied to clipboard

Marks the shortcut as long-lived, allowing the system to cache it (for example for sharing targets and conversation notifications).

Link copied to clipboard

Longer label shown when the launcher has room for it.

Link copied to clipboard
var rank: Int

Relative ordering among the app's shortcuts; lower ranks appear first.

Link copied to clipboard

Short label shown under the shortcut icon. Required.

Functions

Link copied to clipboard
fun adaptiveIcon(bitmap: Bitmap)

Adaptive icon from a full-bleed bitmap; wins over the icon resource.

Link copied to clipboard
fun icon(icon: IconCompat)

Icon from an arbitrary IconCompat; wins over the icon resource.

Link copied to clipboard
fun intent(intent: Intent)

Adds a pre-built launch intent. The intent must have an action set.

fun intent(block: IntentSpec.() -> Unit)

Adds a launch intent built with the IntentSpec DSL. Repeat to build a back stack; the last intent added is the one launched.