Program.Builder

public class Program.Builder


This Builder class simplifies the creation of a Program object.

Summary

Public constructors

Creates a new Builder object.

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

Public methods

Program
T
setAudioLanguages(String[] audioLanguages)

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

Program.Builder
setBroadcastGenres(String[] genres)

Sets the broadcast-specified genres of the program.

T
setCanonicalGenres(String[] genres)

Sets the genres of the program.

Program.Builder
setChannelId(long channelId)

Sets the ID of the Channel that contains this program.

T
setContentRatings(TvContentRating[] contentRatings)

Sets the content ratings for this program.

T
setDescription(String description)

Sets a brief description of the program.

Program.Builder
setEndTimeUtcMillis(long endTimeUtcMillis)

Sets the time when this program is going to end in milliseconds since the epoch.

T
setEpisodeNumber(int episodeNumber)

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

T
setEpisodeNumber(String episodeNumber, int numericalEpisodeNumber)

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

T
setEpisodeTitle(String episodeTitle)

Sets the title of this particular episode for a series.

@NonNull Program.Builder
setEventId(int eventId)

Sets the event ID for this program.

@NonNull Program.Builder

Sets the global content ID for this program.

T
setId(long programId)

Sets a unique id for this program.

T

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

T

Sets the internal provider flag1 for the program.

T

Sets the internal provider flag2 for the program.

T

Sets the internal provider flag3 for the program.

T

Sets the internal provider flag4 for the program.

T
setLongDescription(String longDescription)

Sets a longer description of a program if one exists.

T
setPosterArtUri(Uri posterArtUri)

Sets the large poster art of the program.

Program.Builder
setRecordingProhibited(boolean prohibited)

Sets whether this program cannot be recorded.

T
setReviewRating(String reviewRating)

Sets the review rating score for this program.

T
setReviewRatingStyle(int reviewRatingStyle)

Sets the review rating score style used for setReviewRating.

T
setSearchable(boolean searchable)

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

T
setSeasonNumber(int seasonNumber)

Sets the season number for this episode for a series.

T
setSeasonNumber(String seasonNumber, int numericalSeasonNumber)

Sets the season number for this episode for a series.

T
setSeasonTitle(String seasonTitle)

Sets a custom name for the season, if applicable.

@NonNull T

Sets the series ID for this program.

Program.Builder
setStartTimeUtcMillis(long startTimeUtcMillis)

Sets the time when the program is going to begin in milliseconds since the epoch.

T
setThumbnailUri(Uri thumbnailUri)

Sets a small thumbnail of the program.

T

Sets the title of this program.

T
setVideoHeight(int height)

Sets the video height of the program.

T
setVideoWidth(int width)

Sets the video width of the program.

Public constructors

Builder

Added in 1.1.0-alpha02
public Builder()

Creates a new Builder object.

Builder

Added in 1.1.0-alpha02
public Builder(Program other)

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

Parameters
Program other

The Program you're copying from.

Public methods

build

Added in 1.1.0-alpha02
public Program build()
Returns
Program

A new Program with values supplied by the Builder.

setAudioLanguages

Added in 1.1.0-alpha02
public T setAudioLanguages(String[] audioLanguages)

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

Parameters
String[] audioLanguages

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

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

setBroadcastGenres

Added in 1.1.0-alpha02
public Program.Builder setBroadcastGenres(String[] genres)

Sets the broadcast-specified genres of the program.

Parameters
String[] genres

Array of genres that apply to the program based on the broadcast standard which will be flattened to a String to store in a database.

Returns
Program.Builder

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

setCanonicalGenres

Added in 1.1.0-alpha02
public T setCanonicalGenres(String[] genres)

Sets the genres of the program.

Parameters
String[] genres

An array of androidx.tvprovider.media.tv.TvContractCompat.Programs.Genres that apply to the program which will be flattened to a String to store in a database.

Returns
T

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

setChannelId

Added in 1.1.0-alpha02
public Program.Builder setChannelId(long channelId)

Sets the ID of the Channel that contains this program.

setContentRatings

Added in 1.1.0-alpha02
public T setContentRatings(TvContentRating[] contentRatings)

Sets the content ratings for this program.

Parameters
TvContentRating[] contentRatings

An array of android.media.tv.TvContentRating that apply to this program which will be flattened to a String to store in a database.

Returns
T

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

setDescription

Added in 1.1.0-alpha02
public T setDescription(String description)

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

Parameters
String description

The short description for the program.

Returns
T

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

setEndTimeUtcMillis

Added in 1.1.0-alpha02
public Program.Builder setEndTimeUtcMillis(long endTimeUtcMillis)

Sets the time when this program is going to end in milliseconds since the epoch.

Parameters
long endTimeUtcMillis

The value of COLUMN_END_TIME_UTC_MILLIS for the program.

Returns
Program.Builder

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

setEpisodeNumber

Added in 1.1.0-alpha02
public T setEpisodeNumber(int episodeNumber)

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

Parameters
int episodeNumber

The value of episode display number for the program.

Returns
T

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

setEpisodeNumber

Added in 1.1.0-alpha02
public T setEpisodeNumber(String episodeNumber, int numericalEpisodeNumber)

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

Parameters
String episodeNumber

The value of episode display number for the program.

int numericalEpisodeNumber

An integer value for COLUMN_EPISODE_NUMBER which will be used for API Level 23 and below.

Returns
T

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

setEpisodeTitle

Added in 1.1.0-alpha02
public T setEpisodeTitle(String episodeTitle)

Sets the title of this particular episode for a series.

Parameters
String episodeTitle

The episode title for the program.

Returns
T

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

setEventId

Added in 1.1.0-alpha02
public @NonNull Program.Builder setEventId(int eventId)

Sets the event ID for this program.

No-op on devices prior to R.

Parameters
int eventId

The value of COLUMN_EVENT_ID for the program.

Returns
@NonNull Program.Builder

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

setGlobalContentId

Added in 1.1.0-alpha02
public @NonNull Program.Builder setGlobalContentId(@Nullable String globalContentId)

Sets the global content ID for this program.

No-op on devices prior to R.

Parameters
@Nullable String globalContentId

The value of COLUMN_GLOBAL_CONTENT_ID for the program.

Returns
@NonNull Program.Builder

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

setId

Added in 1.1.0-alpha02
public T setId(long programId)

Sets a unique id for this program.

Parameters
long programId

The ID for the program.

Returns
T

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

See also
_ID

setInternalProviderData

Added in 1.1.0-alpha02
public T setInternalProviderData(byte[] data)

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

Parameters
byte[] data

The internal provider data for the program.

Returns
T

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

setInternalProviderFlag1

Added in 1.1.0-alpha02
public T setInternalProviderFlag1(long flag)

Sets the internal provider flag1 for the program.

Parameters
long flag

The first internal provider flag for the program.

Returns
T

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

setInternalProviderFlag2

Added in 1.1.0-alpha02
public T setInternalProviderFlag2(long flag)

Sets the internal provider flag2 for the program.

Parameters
long flag

The second internal provider flag for the program.

Returns
T

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

setInternalProviderFlag3

Added in 1.1.0-alpha02
public T setInternalProviderFlag3(long flag)

Sets the internal provider flag3 for the program.

Parameters
long flag

The third internal provider flag for the program.

Returns
T

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

setInternalProviderFlag4

Added in 1.1.0-alpha02
public T setInternalProviderFlag4(long flag)

Sets the internal provider flag4 for the program.

Parameters
long flag

The forth internal provider flag for the program.

Returns
T

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

setLongDescription

Added in 1.1.0-alpha02
public T setLongDescription(String longDescription)

Sets a longer description of a program if one exists.

Parameters
String longDescription

The long description for the program.

Returns
T

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

setPosterArtUri

Added in 1.1.0-alpha02
public T setPosterArtUri(Uri posterArtUri)

Sets the large poster art of the program.

Parameters
Uri posterArtUri

The poster art URI for the program.

Returns
T

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

setRecordingProhibited

Added in 1.1.0-alpha02
public Program.Builder setRecordingProhibited(boolean prohibited)

Sets whether this program cannot be recorded.

Parameters
boolean prohibited

The value of COLUMN_RECORDING_PROHIBITED for the program.

Returns
Program.Builder

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

setReviewRating

Added in 1.1.0-alpha02
public T 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
String reviewRating

The value of the review rating for the program.

Returns
T

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

setReviewRatingStyle

Added in 1.1.0-alpha02
public T setReviewRatingStyle(int reviewRatingStyle)

Sets the review rating score style used for setReviewRating.

Parameters
int reviewRatingStyle

The reviewing rating style for the program.

Returns
T

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

setSearchable

Added in 1.1.0-alpha02
public T setSearchable(boolean searchable)

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

Parameters
boolean searchable

Whether the program is searchable or not.

Returns
T

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

setSeasonNumber

Added in 1.1.0-alpha02
public T setSeasonNumber(int seasonNumber)

Sets the season number for this episode for a series.

Parameters
int seasonNumber

The season display number for the program.

Returns
T

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

setSeasonNumber

Added in 1.1.0-alpha02
public T setSeasonNumber(String seasonNumber, int numericalSeasonNumber)

Sets the season number for this episode for a series.

Parameters
String seasonNumber

The season display number for the program.

int numericalSeasonNumber

An integer value for COLUMN_SEASON_NUMBER which will be used for API Level 23 and below.

Returns
T

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

setSeasonTitle

Added in 1.1.0-alpha02
public T setSeasonTitle(String seasonTitle)

Sets a custom name for the season, if applicable.

Parameters
String seasonTitle

The season title for the program.

Returns
T

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

setSeriesId

Added in 1.1.0-alpha02
public @NonNullsetSeriesId(@Nullable String seriesId)

Sets the series ID for this program.

Parameters
@Nullable String seriesId

The series ID for the program.

Returns
@NonNull T

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

See also
COLUMN_SERIES_ID

setStartTimeUtcMillis

Added in 1.1.0-alpha02
public Program.Builder setStartTimeUtcMillis(long startTimeUtcMillis)

Sets the time when the program is going to begin in milliseconds since the epoch.

Parameters
long startTimeUtcMillis

The value of COLUMN_START_TIME_UTC_MILLIS for the program.

Returns
Program.Builder

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

setThumbnailUri

Added in 1.1.0-alpha02
public T setThumbnailUri(Uri thumbnailUri)

Sets a small thumbnail of the program.

Parameters
Uri thumbnailUri

The thumbnail URI for the program.

Returns
T

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

setTitle

Added in 1.1.0-alpha02
public T setTitle(String title)

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

Parameters
String title

The title for the program.

Returns
T

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

See also
COLUMN_TITLE

setVideoHeight

Added in 1.1.0-alpha02
public T setVideoHeight(int height)

Sets the video height of the program.

Parameters
int height

The video height for the program.

Returns
T

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

setVideoWidth

Added in 1.1.0-alpha02
public T setVideoWidth(int width)

Sets the video width of the program.

Parameters
int width

The video width for the program.

Returns
T

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