Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.tvprovider:tvprovider:1.0.0-rc01

PreviewProgram.Builder

public static final class PreviewProgram.Builder
extends Object

java.lang.Object
   ↳ androidx.tvprovider.media.tv.PreviewProgram.Builder


This Builder class simplifies the creation of a PreviewProgram object.

Summary

Public constructors

PreviewProgram.Builder()

Creates a new Builder object.

PreviewProgram.Builder(PreviewProgram other)

Creates a new Builder object with values copied from another Program.

Public methods

PreviewProgram build()
T extends Builder setAudioLanguages(String[] audioLanguages)

Sets the available audio languages for this program as an array of strings.

T extends Builder setAuthor(String author)

Sets the author or artist of this content.

T extends Builder setAvailability(int availability)

Sets the availability of this TV program.

T extends Builder setCanonicalGenres(String[] genres)

Sets the genres of the program.

PreviewProgram.Builder setChannelId(long channelId)

Sets the ID of the Channel that contains this program.

T extends Builder setContentId(String contentId)

Sets the content ID for this program.

T extends Builder setContentRatings(TvContentRating[] contentRatings)

Sets the content ratings for this program.

T extends Builder setDescription(String description)

Sets a brief description of the program.

T extends Builder setDurationMillis(int duration)

Sets the last playback duration (in milliseconds) of the preview video.

T extends Builder setEndTimeUtcMillis(long endTime)

Sets the end time of the program (for live programs).

T extends Builder setEpisodeNumber(int episodeNumber)

Sets the episode number in a season for this episode for a series.

T extends Builder setEpisodeNumber(String episodeNumber, int numericalEpisodeNumber)

Sets the episode number in a season for this episode for a series.

T extends Builder setEpisodeTitle(String episodeTitle)

Sets the title of this particular episode for a series.

T extends Builder setGenre(String genre)

Sets the genre for this program.

T extends Builder setId(long programId)

Sets a unique id for this program.

T extends Builder setIntent(Intent intent)

Sets the intent which is launched when the program is selected.

T extends Builder setIntentUri(Uri intentUri)

Sets the intent URI which is launched when the program is selected.

T extends Builder setInteractionCount(long interactionCount)

Sets the interaction count for this program.

T extends Builder setInteractionType(int interactionType)

Sets the type of interaction for this TV program.

T extends Builder setInternalProviderData(byte[] data)

Sets the internal provider data for the program as raw bytes.

T extends Builder setInternalProviderFlag1(long flag)

Sets the internal provider flag1 for the program.

T extends Builder setInternalProviderFlag2(long flag)

Sets the internal provider flag2 for the program.

T extends Builder setInternalProviderFlag3(long flag)

Sets the internal provider flag3 for the program.

T extends Builder setInternalProviderFlag4(long flag)

Sets the internal provider flag4 for the program.

T extends Builder setInternalProviderId(String externalId)

Sets external ID for the program.

T extends Builder setItemCount(int itemCount)

Sets the count of the items included in this TV program.

T extends Builder setLastPlaybackPositionMillis(int position)

Sets the last playback position (in milliseconds) of the preview video.

T extends Builder setLive(boolean live)

Sets whether this TV program is live or not.

T extends Builder setLogoContentDescription(String logoContentDescription)

Sets the logo's content description for this program.

T extends Builder setLogoUri(Uri logoUri)

Sets the URI for the logo of this TV program.

T extends Builder setLongDescription(String longDescription)

Sets a longer description of a program if one exists.

T extends Builder setOfferPrice(String price)

Sets the offer price of this TV program.

T extends Builder setPosterArtAspectRatio(int ratio)

Sets the aspect ratio of the poster art for this TV program.

T extends Builder setPosterArtUri(Uri posterArtUri)

Sets the large poster art of the program.

T extends Builder setPreviewAudioUri(Uri previewAudioUri)

Sets a URI for the preview audio.

T extends Builder setPreviewVideoUri(Uri previewVideoUri)

Sets a URI for the preview video.

T extends Builder setReleaseDate(String releaseDate)

Sets the release date of this TV program.

T extends Builder setReleaseDate(Date releaseDate)

Sets the release date of this TV program.

T extends Builder setReviewRating(String reviewRating)

Sets the review rating score for this program.

T extends Builder setReviewRatingStyle(int reviewRatingStyle)

Sets the review rating score style used for setReviewRating(String).

T extends Builder setSearchable(boolean searchable)

Sets whether this channel can be searched for in other applications.

T extends Builder setSeasonNumber(String seasonNumber, int numericalSeasonNumber)

Sets the season number for this episode for a series.

T extends Builder setSeasonNumber(int seasonNumber)

Sets the season number for this episode for a series.

T extends Builder setSeasonTitle(String seasonTitle)

Sets a custom name for the season, if applicable.

T extends Builder setStartTimeUtcMillis(long startTime)

Sets the start time of the program (for live programs).

T extends Builder setStartingPrice(String price)

Sets the starting price of this TV program.

T extends Builder setThumbnailAspectRatio(int ratio)

Sets the aspect ratio of the thumbnail for this TV program.

T extends Builder setThumbnailUri(Uri thumbnailUri)

Sets a small thumbnail of the program.

T extends Builder setTitle(String title)

Sets the title of this program.

T extends Builder setTransient(boolean transientValue)

Sets whether this program is transient or not.

T extends Builder setTvSeriesItemType(int type)

Set the TV series item type for this program.

T extends Builder setType(int type)

Sets the type of this program content.

T extends Builder setVideoHeight(int height)

Sets the video height of the program.

T extends Builder setVideoWidth(int width)

Sets the video width of the program.

PreviewProgram.Builder setWeight(int weight)

Sets the weight of the preview program within the channel.

Inherited methods

Public constructors

PreviewProgram.Builder

added in version 1.0.0
public PreviewProgram.Builder ()

Creates a new Builder object.

PreviewProgram.Builder

added in version 1.0.0
public PreviewProgram.Builder (PreviewProgram other)

Creates a new Builder object with values copied from another Program.

Parameters
other PreviewProgram: The Program you're copying from.

Public methods

build

added in version 1.0.0
public PreviewProgram build ()

Returns
PreviewProgram A new Program with values supplied by the Builder.

setAudioLanguages

public T extends Builder setAudioLanguages (String[] audioLanguages)

Sets the available audio languages for this program as an array of strings.

Parameters
audioLanguages String: An array of audio languages, in ISO 639-1 or 639-2/T codes, that apply to this program which will be stored in a database.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setAuthor

public T extends Builder setAuthor (String author)

Sets the author or artist of this content.

Parameters
author String: The author of the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setAvailability

public T extends Builder setAvailability (int availability)

Sets the availability of this TV program.

The value should match one of the followings: .PreviewPrograms#AVAILABILITY_AVAILABLE, .PreviewPrograms#AVAILABILITY_FREE_WITH_SUBSCRIPTION, .PreviewPrograms#AVAILABILITY_PAID_CONTENT, .PreviewPrograms#AVAILABILITY_PURCHASED, and .PreviewPrograms#AVAILABILITY_FREE.

Parameters
availability int: The availability of the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setCanonicalGenres

public T extends Builder setCanonicalGenres (String[] genres)

Sets the genres of the program.

Parameters
genres String: An array of TvContractCompat.Programs.Genres that apply to the program which will be flattened to a String to store in a database.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setChannelId

added in version 1.0.0
public PreviewProgram.Builder setChannelId (long channelId)

Sets the ID of the Channel that contains this program.

Parameters
channelId long: The value of {@link PreviewPrograms#COLUMN_CHANNEL_ID for the program.

Returns
PreviewProgram.Builder This Builder object to allow for chaining of calls to builder methods.

setContentId

public T extends Builder setContentId (String contentId)

Sets the content ID for this program.

Parameters
contentId String: The content ID for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setContentRatings

public T extends Builder setContentRatings (TvContentRating[] contentRatings)

Sets the content ratings for this program.

Parameters
contentRatings TvContentRating: An array of TvContentRating that apply to this program which will be flattened to a String to store in a database.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setDescription

public T extends Builder setDescription (String description)

Sets a brief description of the program. For a series, this would be a brief description of the episode.

Parameters
description String: The short description for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setDurationMillis

public T extends Builder setDurationMillis (int duration)

Sets the last playback duration (in milliseconds) of the preview video.

Parameters
duration int: The duration the program in millis.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setEndTimeUtcMillis

public T extends Builder setEndTimeUtcMillis (long endTime)

Sets the end time of the program (for live programs).

Parameters
endTime long: The end time for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setEpisodeNumber

public T extends Builder setEpisodeNumber (int episodeNumber)

Sets the episode number in a season for this episode for a series.

Parameters
episodeNumber int: The value of episode display number for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setEpisodeNumber

public T extends Builder setEpisodeNumber (String episodeNumber, 
                int numericalEpisodeNumber)

Sets the episode number in a season for this episode for a series.

Parameters
episodeNumber String: The value of episode display number for the program.

numericalEpisodeNumber int: An integer value for TvContractCompat.Programs.COLUMN_EPISODE_NUMBER which will be used for API Level 23 and below.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setEpisodeTitle

public T extends Builder setEpisodeTitle (String episodeTitle)

Sets the title of this particular episode for a series.

Parameters
episodeTitle String: The episode title for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setGenre

public T extends Builder setGenre (String genre)

Sets the genre for this program.

Parameters
genre String: The genre for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setId

public T extends Builder setId (long programId)

Sets a unique id for this program.

Parameters
programId long: The ID for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

See also:

setIntent

public T extends Builder setIntent (Intent intent)

Sets the intent which is launched when the program is selected.

Parameters
intent Intent: The Intent to be executed when the preview program is selected

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setIntentUri

public T extends Builder setIntentUri (Uri intentUri)

Sets the intent URI which is launched when the program is selected.

Parameters
intentUri Uri: The intent URI for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setInteractionCount

public T extends Builder setInteractionCount (long interactionCount)

Sets the interaction count for this program.

Parameters
interactionCount long: The interaction count for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setInteractionType

public T extends Builder setInteractionType (int interactionType)

Sets the type of interaction for this TV program.

The value should match one of the followings: .PreviewPrograms#INTERACTION_TYPE_LISTENS, .PreviewPrograms#INTERACTION_TYPE_FOLLOWERS, TvContractCompat.PreviewPrograms.INTERACTION_TYPE_FANS, TvContractCompat.PreviewPrograms.INTERACTION_TYPE_LIKES, .PreviewPrograms#INTERACTION_TYPE_THUMBS, TvContractCompat.PreviewPrograms.INTERACTION_TYPE_VIEWS, and .PreviewPrograms#INTERACTION_TYPE_VIEWERS.

Parameters
interactionType int: The interaction type of the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setInternalProviderData

public T extends Builder setInternalProviderData (byte[] data)

Sets the internal provider data for the program as raw bytes.

Parameters
data byte: The internal provider data for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setInternalProviderFlag1

public T extends Builder setInternalProviderFlag1 (long flag)

Sets the internal provider flag1 for the program.

Parameters
flag long: The first internal provider flag for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setInternalProviderFlag2

public T extends Builder setInternalProviderFlag2 (long flag)

Sets the internal provider flag2 for the program.

Parameters
flag long: The second internal provider flag for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setInternalProviderFlag3

public T extends Builder setInternalProviderFlag3 (long flag)

Sets the internal provider flag3 for the program.

Parameters
flag long: The third internal provider flag for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setInternalProviderFlag4

public T extends Builder setInternalProviderFlag4 (long flag)

Sets the internal provider flag4 for the program.

Parameters
flag long: The forth internal provider flag for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setInternalProviderId

public T extends Builder setInternalProviderId (String externalId)

Sets external ID for the program.

Parameters
externalId String: The internal provider ID for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setItemCount

public T extends Builder setItemCount (int itemCount)

Sets the count of the items included in this TV program.

Parameters
itemCount int: The item count for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setLastPlaybackPositionMillis

public T extends Builder setLastPlaybackPositionMillis (int position)

Sets the last playback position (in milliseconds) of the preview video.

Parameters
position int: The last playback posirion for the program in millis.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setLive

public T extends Builder setLive (boolean live)

Sets whether this TV program is live or not.

Parameters
live boolean: Whether the program is live or not.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setLogoContentDescription

public T extends Builder setLogoContentDescription (String logoContentDescription)

Sets the logo's content description for this program.

Parameters
logoContentDescription String: The content description for the logo displayed in the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setLogoUri

public T extends Builder setLogoUri (Uri logoUri)

Sets the URI for the logo of this TV program.

Parameters
logoUri Uri: The logo URI for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setLongDescription

public T extends Builder setLongDescription (String longDescription)

Sets a longer description of a program if one exists.

Parameters
longDescription String: The long description for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setOfferPrice

public T extends Builder setOfferPrice (String price)

Sets the offer price of this TV program.

Parameters
price String: The offer price of the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setPosterArtAspectRatio

public T extends Builder setPosterArtAspectRatio (int ratio)

Sets the aspect ratio of the poster art for this TV program.

The value should match one of the followings: TvContractCompat.PreviewPrograms.ASPECT_RATIO_16_9, TvContractCompat.PreviewPrograms.ASPECT_RATIO_3_2, TvContractCompat.PreviewPrograms.ASPECT_RATIO_4_3, TvContractCompat.PreviewPrograms.ASPECT_RATIO_1_1, TvContractCompat.PreviewPrograms.ASPECT_RATIO_2_3, and .PreviewPrograms#ASPECT_RATIO_MOVIE_POSTER.

Parameters
ratio int: The poster art aspect ratio for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setPosterArtUri

public T extends Builder setPosterArtUri (Uri posterArtUri)

Sets the large poster art of the program.

Parameters
posterArtUri Uri: The poster art URI for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setPreviewAudioUri

public T extends Builder setPreviewAudioUri (Uri previewAudioUri)

Sets a URI for the preview audio.

Parameters
previewAudioUri Uri: The preview audio URI for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setPreviewVideoUri

public T extends Builder setPreviewVideoUri (Uri previewVideoUri)

Sets a URI for the preview video.

Parameters
previewVideoUri Uri: The preview video URI for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setReleaseDate

public T extends Builder setReleaseDate (String releaseDate)

Sets the release date of this TV program.

The value should be in one of the following formats: "yyyy", "yyyy-MM-dd", and "yyyy-MM-ddTHH:mm:ssZ" (UTC in ISO 8601).

Parameters
releaseDate String: The release date of the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setReleaseDate

public T extends Builder setReleaseDate (Date releaseDate)

Sets the release date of this TV program.

Parameters
releaseDate Date: The release date of the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setReviewRating

public T extends Builder setReviewRating (String reviewRating)

Sets the review rating score for this program.

The format of the value is dependent on the review rating style. If the style is based on "stars", the value should be a real number between 0.0 and 5.0. (e.g. "4.5") If the style is based on "thumbs up/down", the value should be two integers, one for thumbs-up count and the other for thumbs-down count, with a comma between them. (e.g. "200,40") If the style is base on "percentage", the value should be a real number between 0 and 100. (e.g. "99.9")

Parameters
reviewRating String: The value of the review rating for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setReviewRatingStyle

public T extends Builder setReviewRatingStyle (int reviewRatingStyle)

Sets the review rating score style used for setReviewRating(String).

Parameters
reviewRatingStyle int: The reviewing rating style for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setSearchable

public T extends Builder setSearchable (boolean searchable)

Sets whether this channel can be searched for in other applications.

Parameters
searchable boolean: Whether the program is searchable or not.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setSeasonNumber

public T extends Builder setSeasonNumber (String seasonNumber, 
                int numericalSeasonNumber)

Sets the season number for this episode for a series.

Parameters
seasonNumber String: The season display number for the program.

numericalSeasonNumber int: An integer value for TvContractCompat.Programs.COLUMN_SEASON_NUMBER which will be used for API Level 23 and below.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setSeasonNumber

public T extends Builder setSeasonNumber (int seasonNumber)

Sets the season number for this episode for a series.

Parameters
seasonNumber int: The season display number for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setSeasonTitle

public T extends Builder setSeasonTitle (String seasonTitle)

Sets a custom name for the season, if applicable.

Parameters
seasonTitle String: The season title for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setStartTimeUtcMillis

public T extends Builder setStartTimeUtcMillis (long startTime)

Sets the start time of the program (for live programs).

Parameters
startTime long: The start time for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setStartingPrice

public T extends Builder setStartingPrice (String price)

Sets the starting price of this TV program.

Parameters
price String: The starting price of the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setThumbnailAspectRatio

public T extends Builder setThumbnailAspectRatio (int ratio)

Sets the aspect ratio of the thumbnail for this TV program.

The value should match one of the followings: TvContractCompat.PreviewPrograms.ASPECT_RATIO_16_9, TvContractCompat.PreviewPrograms.ASPECT_RATIO_3_2, TvContractCompat.PreviewPrograms.ASPECT_RATIO_4_3, TvContractCompat.PreviewPrograms.ASPECT_RATIO_1_1, TvContractCompat.PreviewPrograms.ASPECT_RATIO_2_3, and .PreviewPrograms#ASPECT_RATIO_MOVIE_POSTER.

Parameters
ratio int: The thumbnail aspect ratio of the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setThumbnailUri

public T extends Builder setThumbnailUri (Uri thumbnailUri)

Sets a small thumbnail of the program.

Parameters
thumbnailUri Uri: The thumbnail URI for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setTitle

public T extends Builder setTitle (String title)

Sets the title of this program. For a series, this is the series title.

Parameters
title String: The title for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setTransient

public T extends Builder setTransient (boolean transientValue)

Sets whether this program is transient or not.

Parameters
transientValue boolean: Whether the program is transient or not.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setTvSeriesItemType

public T extends Builder setTvSeriesItemType (int type)

Set the TV series item type for this program.

Parameters
type int: the TV series item type

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setVideoHeight

public T extends Builder setVideoHeight (int height)

Sets the video height of the program.

Parameters
height int: The video height for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setVideoWidth

public T extends Builder setVideoWidth (int width)

Sets the video width of the program.

Parameters
width int: The video width for the program.

Returns
T extends Builder This Builder object to allow for chaining of calls to builder methods.

setWeight

added in version 1.0.0
public PreviewProgram.Builder setWeight (int weight)

Sets the weight of the preview program within the channel.

Parameters
weight int: The value of TvContractCompat.PreviewPrograms.COLUMN_WEIGHT for the program.

Returns
PreviewProgram.Builder This Builder object to allow for chaining of calls to builder methods.