belongs to Maven artifact androidx.tvprovider:tvprovider:1.0.0-alpha1

PreviewChannel

public class PreviewChannel
extends Object

java.lang.Object
   ↳ androidx.tvprovider.media.tv.PreviewChannel


Since API 26, all TV apps may create preview channels and publish them to the home screen. We call these App Channels (as distinct from the Live Channels row on the home screen). To help you create App Channels, the support library provides a number of classes prefixed by the word Preview-. This is a convenience class for mapping your app's content into a TvProvider Channel for publication. Use the provided PreviewChannel.Builder for creating your preview channel object. Once you create a preview channel, you can use PreviewChannelHelper to publish it and add programs to it.

Summary

Nested classes

class PreviewChannel.Builder

This builder makes it easy to create a PreviewChannel object by allowing you to chain setters. 

Public methods

boolean equals(Object other)
static PreviewChannel fromCursor(Cursor cursor)

Used by PreviewChannelHelper to transduce a TvProvider channel row into a PreviewChannel Java object.

Intent getAppLinkIntent()
Uri getAppLinkIntentUri()
CharSequence getDescription()
CharSequence getDisplayName()
long getId()
byte[] getInternalProviderDataByteArray()
Long getInternalProviderFlag1()
Long getInternalProviderFlag2()
Long getInternalProviderFlag3()
Long getInternalProviderFlag4()
String getInternalProviderId()
Bitmap getLogo(Context context)

This method should be called on a worker thread since decoding Bitmap is an expensive operation and therefore should not be performed on the main thread.

String getPackageName()
String getType()
boolean hasAnyUpdatedValues(PreviewChannel update)

Indicates whether some other PreviewChannel has any set attribute that is different from this PreviewChannel's respective attributes.

int hashCode()
boolean isBrowsable()
String toString()

Inherited methods

Public methods

equals

boolean equals (Object other)

Parameters
other Object

Returns
boolean

fromCursor

PreviewChannel fromCursor (Cursor cursor)

Used by PreviewChannelHelper to transduce a TvProvider channel row into a PreviewChannel Java object. You never need to use this method unless you want to convert database rows to PreviewChannel objects yourself.

This method assumes the cursor was obtained using .PreviewChannel.Columns#PROJECTION. This way, all indices are known beforehand.

Parameters
cursor Cursor: a cursor row from the TvProvider

Returns
PreviewChannel a PreviewChannel whose values come from the cursor row

getAppLinkIntent

Intent getAppLinkIntent ()

Returns
Intent The value of TvContractCompat.Channels.COLUMN_APP_LINK_INTENT_URI for the program.

Throws
URISyntaxException

getAppLinkIntentUri

Uri getAppLinkIntentUri ()

Returns
Uri The value of TvContractCompat.Channels.COLUMN_APP_LINK_INTENT_URI for the channel.

getDescription

CharSequence getDescription ()

Returns
CharSequence The value of TvContractCompat.Channels.COLUMN_DESCRIPTION for the channel. A short text explaining what this channel contains.

getDisplayName

CharSequence getDisplayName ()

Returns
CharSequence The name users see when this channel appears on the home screen

getId

long getId ()

Returns
long the ID the system assigns to this preview channel upon publication.

getInternalProviderDataByteArray

byte[] getInternalProviderDataByteArray ()

Returns
byte[] The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_DATA for the channel.

getInternalProviderFlag1

Long getInternalProviderFlag1 ()

Returns
Long The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_FLAG1 for the channel.

getInternalProviderFlag2

Long getInternalProviderFlag2 ()

Returns
Long The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_FLAG2 for the channel.

getInternalProviderFlag3

Long getInternalProviderFlag3 ()

Returns
Long The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_FLAG3 for the channel.

getInternalProviderFlag4

Long getInternalProviderFlag4 ()

Returns
Long The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_FLAG4 for the channel.

getInternalProviderId

String getInternalProviderId ()

Returns
String The value of TvContractCompat.Channels.COLUMN_INTERNAL_PROVIDER_ID for the channel.

getLogo

Bitmap getLogo (Context context)

This method should be called on a worker thread since decoding Bitmap is an expensive operation and therefore should not be performed on the main thread.

Parameters
context Context

Returns
Bitmap The logo associated with this preview channel

getPackageName

String getPackageName ()

Returns
String package name of the app that created this channel

getType

String getType ()

Returns
String what type of channel this is. For preview channels, the type is always TvContractCompat.Channels.TYPE_PREVIEW

hasAnyUpdatedValues

boolean hasAnyUpdatedValues (PreviewChannel update)

Indicates whether some other PreviewChannel has any set attribute that is different from this PreviewChannel's respective attributes. An attribute is considered "set" if its key is present in the ContentValues vector.

Parameters
update PreviewChannel

Returns
boolean

hashCode

int hashCode ()

Returns
int

isBrowsable

boolean isBrowsable ()

Returns
boolean The value of TvContractCompat.Channels.COLUMN_BROWSABLE for the channel. A preview channel is BROWABLE when it is visible on the TV home screen.

toString

String toString ()

Returns
String