PreviewProgram
public
final
class
PreviewProgram
extends Object
java.lang.Object
|
↳ |
androidx.tvprovider.media.tv.PreviewProgram
|
A convenience class to access TvContractCompat.PreviewPrograms
entries in the system content
provider.
This class makes it easy to insert or retrieve a preview program from the system content
provider, which is defined in TvContractCompat
.
Usage example when inserting a preview program:
PreviewProgram previewProgram = new PreviewProgram.Builder()
.setChannelId(channel.getId())
.setType(PreviewPrograms.TYPE_MOVIE)
.setTitle("Program Title")
.setDescription("Program Description")
.setPosterArtUri(Uri.parse("http://example.com/poster_art.png"))
// Set more attributes...
.build();
Uri previewProgramUri = getContentResolver().insert(PreviewPrograms.CONTENT_URI,
previewProgram.toContentValues());
Usage example when retrieving a preview program:
PreviewProgram previewProgram;
try (Cursor cursor = resolver.query(previewProgramUri, null, null, null, null)) {
if (cursor != null && cursor.getCount() != 0) {
cursor.moveToNext();
previewProgram = PreviewProgram.fromCursor(cursor);
}
}
Usage example when updating an existing preview program:
PreviewProgram updatedProgram = new PreviewProgram.Builder(previewProgram)
.setWeight(20)
.build();
getContentResolver().update(TvContractCompat.buildPreviewProgramUri(updatedProgram.getId()),
updatedProgram.toContentValues(), null, null);
Usage example when deleting a preview program:
getContentResolver().delete(TvContractCompat.buildPreviewProgramUri(existingProgram.getId()),
null, null);
Summary
Nested classes |
class |
PreviewProgram.Builder
This Builder class simplifies the creation of a PreviewProgram object.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public methods
equals
public boolean equals (Object other)
getAudioLanguages
public String[] getAudioLanguages ()
Returns |
String[] |
The audio languages for the program. |
getAuthor
public String getAuthor ()
Returns |
String |
The author for the program. |
getAvailability
public int getAvailability ()
Returns |
int |
The availability of the program. |
getCanonicalGenres
public String[] getCanonicalGenres ()
Returns |
String[] |
The canonical genre for the program. |
getChannelId
public long getChannelId ()
getContentId
public String getContentId ()
Returns |
String |
The content ID for the program. |
getDescription
public String getDescription ()
Returns |
String |
The short description for the program. |
getDurationMillis
public int getDurationMillis ()
Returns |
int |
The duration of the program in millis. |
getEndTimeUtcMillis
public long getEndTimeUtcMillis ()
Returns |
long |
The end time for the program. |
getEpisodeNumber
public String getEpisodeNumber ()
Returns |
String |
The episode display number for the program. |
getEpisodeTitle
public String getEpisodeTitle ()
Returns |
String |
The episode title for the program. |
getGenre
public String getGenre ()
Returns |
String |
The genre for the program. |
getId
public long getId ()
Returns |
long |
The ID for the program. |
getIntent
public Intent getIntent ()
Returns |
Intent |
The intent which is launched when the program is selected. |
Throws |
URISyntaxException |
|
getIntentUri
public Uri getIntentUri ()
Returns |
Uri |
The intent URI which is launched when the program is selected. |
getInteractionCount
public long getInteractionCount ()
Returns |
long |
The interaction count for the program. |
getInteractionType
public int getInteractionType ()
Returns |
int |
The interaction type for the program. |
getInternalProviderDataByteArray
public byte[] getInternalProviderDataByteArray ()
Returns |
byte[] |
The internal provider data for the program. |
getInternalProviderFlag1
public Long getInternalProviderFlag1 ()
Returns |
Long |
The first internal provider flag for the program. |
getInternalProviderFlag2
public Long getInternalProviderFlag2 ()
Returns |
Long |
The second internal provider flag for the program. |
getInternalProviderFlag3
public Long getInternalProviderFlag3 ()
Returns |
Long |
The third internal provider flag for the program. |
getInternalProviderFlag4
public Long getInternalProviderFlag4 ()
Returns |
Long |
The forth internal provider flag for the program. |
getInternalProviderId
public String getInternalProviderId ()
Returns |
String |
The internal provider ID for the program. |
getItemCount
public int getItemCount ()
Returns |
int |
The item count for the program. |
getLastPlaybackPositionMillis
public int getLastPlaybackPositionMillis ()
Returns |
int |
The last playback position of the program in millis. |
getLogoContentDescription
public String getLogoContentDescription ()
Returns |
String |
The logo content description for the program. |
getLogoUri
public Uri getLogoUri ()
Returns |
Uri |
The logo URI for the program. |
getLongDescription
public String getLongDescription ()
Returns |
String |
The long description for the program. |
getOfferPrice
public String getOfferPrice ()
Returns |
String |
The offer price of the program. |
getPosterArtAspectRatio
public int getPosterArtAspectRatio ()
Returns |
int |
The poster art aspect ratio for the program. |
getPosterArtUri
public Uri getPosterArtUri ()
Returns |
Uri |
The poster art URI for the program. |
getPreviewAudioUri
public Uri getPreviewAudioUri ()
Returns |
Uri |
The preview audio URI for the program. |
getPreviewVideoUri
public Uri getPreviewVideoUri ()
Returns |
Uri |
The preview video URI for the program. |
getReleaseDate
public String getReleaseDate ()
Returns |
String |
The release date of the program. |
getReviewRating
public String getReviewRating ()
Returns |
String |
The review rating for the program. |
getReviewRatingStyle
public int getReviewRatingStyle ()
Returns |
int |
The review rating style for the program. |
getSeasonNumber
public String getSeasonNumber ()
Returns |
String |
The season display number for the program. |
getSeasonTitle
public String getSeasonTitle ()
Returns |
String |
The season title for the program. |
getSeriesId
public String getSeriesId ()
Returns |
String |
The series ID for the program. |
getStartTimeUtcMillis
public long getStartTimeUtcMillis ()
Returns |
long |
The start time for the program. |
getStartingPrice
public String getStartingPrice ()
Returns |
String |
The starting price of the program. |
getThumbnailAspectRatio
public int getThumbnailAspectRatio ()
Returns |
int |
The thumbnail aspect ratio for the program. |
getThumbnailUri
public Uri getThumbnailUri ()
Returns |
Uri |
The thumbnail URI for the program. |
getTitle
public String getTitle ()
Returns |
String |
The title for the program. |
getTvSeriesItemType
public int getTvSeriesItemType ()
Returns |
int |
The TV series item type for the program.
|
getType
public int getType ()
Returns |
int |
The type of the program. |
getVideoHeight
public int getVideoHeight ()
Returns |
int |
The video height for the program. |
getVideoWidth
public int getVideoWidth ()
Returns |
int |
The video width for the program. |
getWeight
public int getWeight ()
public boolean hasAnyUpdatedValues (PreviewProgram update)
Indicates whether some other PreviewProgram has any set attribute that is different from
this PreviewProgram's respective attributes. An attribute is considered "set" if its key
is present in the ContentValues vector.
Parameters |
update |
PreviewProgram |
hashCode
public int hashCode ()
isBrowsable
public boolean isBrowsable ()
Returns |
boolean |
Whether the program is browsable or not. |
isLive
public boolean isLive ()
Returns |
boolean |
Whether the program is live or not. |
isSearchable
public boolean isSearchable ()
Returns |
boolean |
Whether the program is searchable or not. |
isTransient
public boolean isTransient ()
Returns |
boolean |
Whether the program is transient or not. |
toContentValues
public ContentValues toContentValues ()
Returns |
ContentValues |
The fields of the Program in the ContentValues format to be easily inserted into the
TV Input Framework database.
|
toString
public String toString ()
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples/Code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.