RouteListingPreference.Item
public final class RouteListingPreference.Item
Holds preference information for a specific route in a RouteListingPreference.
Summary
Nested types |
|---|
public final class RouteListingPreference.Item.BuilderBuilder for |
Constants |
|
|---|---|
static final int |
The corresponding route is already hosting a session with the app that owns this listing preference. |
static final int |
Signals that the ongoing session on the corresponding route is managed by the current user of the app. |
static final int |
FLAG_SUGGESTED = 4The corresponding route is specially likely to be selected by the user. |
static final int |
If the user selects the corresponding route, the system takes the user to the application. |
static final int |
The corresponding route is not selectable by the user. |
static final int |
If the user selects the corresponding route, the media transfers to the said route. |
static final int |
The corresponding route's subtext must indicate that it is not available because an ad is in progress. |
static final int |
SUBTEXT_CUSTOM = 10000The corresponding route's subtext must be obtained from |
static final int |
The corresponding route's subtext must indicate that it is not available because the device is in low-power mode. |
static final int |
The corresponding route's subtext must indicate that downloaded content cannot be routed to it. |
static final int |
The corresponding route's subtext must indicate that it is not available because of an unknown error. |
static final int |
SUBTEXT_NONE = 0The corresponding route has no associated subtext. |
static final int |
The corresponding route's subtext must indicate that it requires a special subscription in order to be available for routing. |
static final int |
The corresponding route's subtext must indicate that it is not available because the device does not support the current media track. |
static final int |
The corresponding route's subtext must indicate that it is not available because the user is not authorized to route to it. |
Public methods |
|
|---|---|
boolean |
|
@Nullable CharSequence |
Returns a human-readable |
int |
getFlags()Returns the flags associated to the route that corresponds to this item. |
@NonNull String |
Returns the id of the route that corresponds to this route listing preference item. |
int |
Returns the behavior that the corresponding route has if the user selects it. |
int |
Returns the type of subtext associated to this route. |
int |
hashCode() |
Constants
FLAG_ONGOING_SESSION
public static final int FLAG_ONGOING_SESSION = 1
The corresponding route is already hosting a session with the app that owns this listing preference.
FLAG_ONGOING_SESSION_MANAGED
public static final int FLAG_ONGOING_SESSION_MANAGED = 2
Signals that the ongoing session on the corresponding route is managed by the current user of the app.
The system can use this flag to provide visual indication that the route is not only hosting a session, but also that the user has ownership over said session.
This flag is ignored if FLAG_ONGOING_SESSION is not set, or if the corresponding route is not currently selected.
This flag does not affect volume adjustment (see androidx.media.VolumeProviderCompat, and getVolumeHandling), or any aspect other than the visual representation of the corresponding item.
FLAG_SUGGESTED
public static final int FLAG_SUGGESTED = 4
The corresponding route is specially likely to be selected by the user.
A UI reflecting this preference may reserve a specific space for suggested routes, making it more accessible to the user. If the number of suggested routes exceeds the number supported by the UI, the routes listed first in getItems will take priority.
SELECTION_BEHAVIOR_GO_TO_APP
public static final int SELECTION_BEHAVIOR_GO_TO_APP = 2
If the user selects the corresponding route, the system takes the user to the application.
The system uses getLinkedItemComponentName in order to navigate to the app.
SELECTION_BEHAVIOR_NONE
public static final int SELECTION_BEHAVIOR_NONE = 0
The corresponding route is not selectable by the user.
SELECTION_BEHAVIOR_TRANSFER
public static final int SELECTION_BEHAVIOR_TRANSFER = 1
If the user selects the corresponding route, the media transfers to the said route.
SUBTEXT_AD_ROUTING_DISALLOWED
public static final int SUBTEXT_AD_ROUTING_DISALLOWED = 4
The corresponding route's subtext must indicate that it is not available because an ad is in progress.
SUBTEXT_CUSTOM
public static final int SUBTEXT_CUSTOM = 10000
The corresponding route's subtext must be obtained from getCustomSubtextMessage.
Applications should strongly prefer one of the other disable reasons (for the full list, see getSubText) in order to guarantee correct localization and rendering across all form factors.
SUBTEXT_DEVICE_LOW_POWER
public static final int SUBTEXT_DEVICE_LOW_POWER = 5
The corresponding route's subtext must indicate that it is not available because the device is in low-power mode.
SUBTEXT_DOWNLOADED_CONTENT_ROUTING_DISALLOWED
public static final int SUBTEXT_DOWNLOADED_CONTENT_ROUTING_DISALLOWED = 3
The corresponding route's subtext must indicate that downloaded content cannot be routed to it.
SUBTEXT_ERROR_UNKNOWN
public static final int SUBTEXT_ERROR_UNKNOWN = 1
The corresponding route's subtext must indicate that it is not available because of an unknown error.
SUBTEXT_NONE
public static final int SUBTEXT_NONE = 0
The corresponding route has no associated subtext.
SUBTEXT_SUBSCRIPTION_REQUIRED
public static final int SUBTEXT_SUBSCRIPTION_REQUIRED = 2
The corresponding route's subtext must indicate that it requires a special subscription in order to be available for routing.
SUBTEXT_TRACK_UNSUPPORTED
public static final int SUBTEXT_TRACK_UNSUPPORTED = 7
The corresponding route's subtext must indicate that it is not available because the device does not support the current media track.
SUBTEXT_UNAUTHORIZED
public static final int SUBTEXT_UNAUTHORIZED = 6
The corresponding route's subtext must indicate that it is not available because the user is not authorized to route to it.
Public methods
getCustomSubtextMessage
public @Nullable CharSequence getCustomSubtextMessage()
Returns a human-readable CharSequence providing the subtext for the corresponding route.
This value is ignored if the subtext for this item is not SUBTEXT_CUSTOM..
Applications must provide a localized message that matches the system's locale. See getDefault.
Applications should avoid using custom messages (and instead use one of non-custom subtexts listed in getSubText in order to guarantee correct visual representation and localization on all form factors.
getFlags
public int getFlags()
Returns the flags associated to the route that corresponds to this item.
getRouteId
public @NonNull String getRouteId()
Returns the id of the route that corresponds to this route listing preference item.
| See also | |
|---|---|
getId |
getSelectionBehavior
public int getSelectionBehavior()
Returns the behavior that the corresponding route has if the user selects it.
getSubText
public int getSubText()
Returns the type of subtext associated to this route.
Subtext types other than SUBTEXT_NONE and SUBTEXT_CUSTOM must not have SELECTION_BEHAVIOR_TRANSFER.
If this method returns SUBTEXT_CUSTOM, then the subtext is obtained form getCustomSubtextMessage.