Tile
class Tile : Parcelable
kotlin.Any | |
↳ | android.service.quicksettings.Tile |
A Tile holds the state of a tile that will be displayed in Quick Settings. A tile in Quick Settings exists as an icon with an accompanied label. It also may have content description for accessibility usability. The style and layout of the tile may change to match a given device.
Summary
Constants | |
---|---|
static Int |
This represents a tile that is currently active. |
static Int |
This represents a tile that is currently in a disabled state but is still interactable. |
static Int |
An unavailable state indicates that for some reason this tile is not currently available to the user, and will have no click action. |
Inherited constants | |
---|---|
Public methods | |
---|---|
Int | |
PendingIntent? |
Gets the Activity |
CharSequence! |
Gets the current content description for the tile. |
Icon! |
getIcon() Gets the current icon for the tile. |
CharSequence! |
getLabel() Gets the current label for the tile. |
Int |
getState() The current state of the tile. |
CharSequence? |
Gets the current state description for the tile. |
CharSequence? |
Gets the current subtitle for the tile. |
Unit |
setActivityLaunchForClick(pendingIntent: PendingIntent?) Sets an Activity |
Unit |
setContentDescription(contentDescription: CharSequence!) Sets the current content description for the tile. |
Unit |
Sets the current icon for the tile. |
Unit |
setLabel(label: CharSequence!) Sets the current label for the tile. |
Unit |
Sets the current state for the tile. |
Unit |
setStateDescription(stateDescription: CharSequence?) Sets the current state description for the tile. |
Unit |
setSubtitle(subtitle: CharSequence?) Set the subtitle for the tile. |
Unit |
Pushes the state of the Tile to Quick Settings to be displayed. |
Unit |
writeToParcel(dest: Parcel, flags: Int) |
Properties | |
---|---|
static Parcelable.Creator<Tile!> |
Constants
STATE_ACTIVE
static val STATE_ACTIVE: Int
This represents a tile that is currently active. (e.g. wifi is connected, bluetooth is on, cast is casting). This is the default state.
Value: 2
STATE_INACTIVE
static val STATE_INACTIVE: Int
This represents a tile that is currently in a disabled state but is still interactable. A disabled state indicates that the tile is not currently active (e.g. wifi disconnected or bluetooth disabled), but is still interactable by the user to modify this state. Tiles that have boolean states should use this to represent one of their states. The tile's icon will be tinted differently to reflect this state, but still be distinct from unavailable.
Value: 1
STATE_UNAVAILABLE
static val STATE_UNAVAILABLE: Int
An unavailable state indicates that for some reason this tile is not currently available to the user, and will have no click action. The tile's icon will be tinted differently to reflect this state.
Value: 0
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 |
getActivityLaunchForClick
fun getActivityLaunchForClick(): PendingIntent?
Gets the Activity PendingIntent
to be launched when the tile is clicked.
Return | |
---|---|
PendingIntent? |
This value may be null . |
getContentDescription
fun getContentDescription(): CharSequence!
Gets the current content description for the tile.
getStateDescription
fun getStateDescription(): CharSequence?
Gets the current state description for the tile.
Return | |
---|---|
CharSequence? |
This value may be null . |
getSubtitle
fun getSubtitle(): CharSequence?
Gets the current subtitle for the tile.
Return | |
---|---|
CharSequence? |
This value may be null . |
setActivityLaunchForClick
fun setActivityLaunchForClick(pendingIntent: PendingIntent?): Unit
Sets an Activity PendingIntent
to be launched when the tile is clicked. The last value set here will be launched when the user clicks in the tile, instead of forwarding the `onClick` message to the TileService
. Set to null
to handle the `onClick` in the `TileService` (This is the default behavior if this method is never called.)
Parameters | |
---|---|
pendingIntent |
PendingIntent?: a PendingIntent for an activity to be launched onclick, or null to handle the clicks in the `TileService`. |
setContentDescription
fun setContentDescription(contentDescription: CharSequence!): Unit
Sets the current content description for the tile. Does not take effect until updateTile()
is called.
Parameters | |
---|---|
contentDescription |
CharSequence!: New content description to use. |
setIcon
fun setIcon(icon: Icon!): Unit
Sets the current icon for the tile. This icon is expected to be white on alpha, and may be tinted by the system to match it's theme. Does not take effect until updateTile()
is called.
Parameters | |
---|---|
icon |
Icon!: New icon to show. |
setLabel
fun setLabel(label: CharSequence!): Unit
Sets the current label for the tile. Does not take effect until updateTile()
is called.
Parameters | |
---|---|
label |
CharSequence!: New label to show. |
setState
fun setState(state: Int): Unit
Sets the current state for the tile. Does not take effect until updateTile()
is called.
Parameters | |
---|---|
state |
Int: One of STATE_UNAVAILABLE , STATE_INACTIVE , STATE_ACTIVE |
setStateDescription
fun setStateDescription(stateDescription: CharSequence?): Unit
Sets the current state description for the tile. Does not take effect until updateTile()
is called.
Parameters | |
---|---|
stateDescription |
CharSequence?: New state description to use. This value may be null . |
setSubtitle
fun setSubtitle(subtitle: CharSequence?): Unit
Set the subtitle for the tile. Will be displayed as the secondary label.
Parameters | |
---|---|
subtitle |
CharSequence?: the subtitle to show. This value may be null . |
updateTile
fun updateTile(): Unit
Pushes the state of the Tile to Quick Settings to be displayed.
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 |