Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る


@WorkerThread open class PreviewChannelHelper

From a user's perspective, the TV home screen has two types of channels: the single Live Channels row versus the App preview Channels. This class is concerned with App Channels; or more precisely: your app's preview Channels. In API 26+, all TV apps are allowed to create multiple channels and publish those Channels to the home screen.

This class provides convenience methods to help you publish, update and delete channels; add, update or remove programs in a channel. You do not need to know anything about Content Providers, Content Resolvers, Cursors or such to publish your channels. This class abstracts away all database interactions for you.

To make it easy for you to distinguish classes that help you build App Channels, the support library uses the prefix Preview- to denote the classes that pertain to app Channels. Hence, the classes PreviewChannel and PreviewProgram help your app add channels to the TV home page. All calls to methods in the class should be made on worker threads.


Public constructors
<init>(context: Context!)

<init>(context: Context!, urlConnectionTimeoutMillis: Int, urlReadTimeoutMillis: Int)

Public methods
open Unit

Removes a preview channel from the system's content provider (aka TvProvider).

open Unit

Removes programs from a preview channel.

open MutableList<PreviewChannel!>!

The TvProvider does not allow select queries.

open PreviewChannel?
getPreviewChannel(channelId: Long)

Retrieves a single preview channel from the TvProvider.

open PreviewProgram?
getPreviewProgram(programId: Long)

Retrieves a single preview program from the system content provider (aka TvProvider).

open WatchNextProgram?

Retrieves a single WatchNext program from the system content provider (aka TvProvider).

open Long
publishChannel(@NonNull channel: PreviewChannel)

Publishing a channel to the TV home screen is a two step process: first, you add the channel to the TV content provider; second, you make the channel browsable (i.e. visible).

open Long

This is a convenience method that simply publishes your first channel for you.

open Long

Adds programs to a preview channel.

open Long

Adds a program to the Watch Next channel

open Unit
updatePreviewChannel(channelId: Long, @NonNull update: PreviewChannel)

To update a preview channel, you need to use the PreviewChannel.Builder to set the attributes you wish to change.

open Unit
updatePreviewProgram(programId: Long, @NonNull update: PreviewProgram)

Updates programs in a preview channel.

open Unit
updateWatchNextProgram(@NonNull upgrade: WatchNextProgram, programId: Long)

Updates a WatchNext program.

Protected methods
open Bitmap!
downloadBitmap(@NonNull logoUri: Uri)

Downloads a Bitmap from a remote server.

Public constructors


PreviewChannelHelper(context: Context!)


    context: Context!,
    urlConnectionTimeoutMillis: Int,
    urlReadTimeoutMillis: Int)
urlConnectionTimeoutMillis Int: see URLConnection#setConnectTimeout(int)
urlReadTimeoutMillis Int: see URLConnection#setReadTimeout(int)

Public methods


open fun deletePreviewChannel(channelId: Long): Unit

Removes a preview channel from the system's content provider (aka TvProvider).


open fun deletePreviewProgram(programId: Long): Unit</