Fields Summary |
---|
public static final String | AUTHORITYThe authority for the TV provider. |
private static final String | PATH_CHANNEL |
private static final String | PATH_PROGRAM |
private static final String | PATH_PASSTHROUGH |
public static final String | PARAM_INPUTAn optional query, update or delete URI parameter that allows the caller to specify TV input
ID to filter channels. |
public static final String | PARAM_CHANNELAn optional query, update or delete URI parameter that allows the caller to specify channel
ID to filter programs. |
public static final String | PARAM_START_TIMEAn optional query, update or delete URI parameter that allows the caller to specify start
time (in milliseconds since the epoch) to filter programs. |
public static final String | PARAM_END_TIMEAn optional query, update or delete URI parameter that allows the caller to specify end time
(in milliseconds since the epoch) to filter programs. |
public static final String | PARAM_BROWSABLE_ONLYA query, update or delete URI parameter that allows the caller to operate on all or
browsable-only channels. If set to "true", the rows that contain non-browsable channels are
not affected. |
public static final String | PARAM_CANONICAL_GENREA optional query, update or delete URI parameter that allows the caller to specify canonical
genre to filter programs. |
Methods Summary |
---|
public static final android.net.Uri | buildChannelLogoUri(long channelId)Builds a URI that points to a channel logo. See {@link Channels.Logo}.
return buildChannelLogoUri(buildChannelUri(channelId));
|
public static final android.net.Uri | buildChannelLogoUri(android.net.Uri channelUri)Builds a URI that points to a channel logo. See {@link Channels.Logo}.
if (!isChannelUriForTunerInput(channelUri)) {
throw new IllegalArgumentException("Not a channel: " + channelUri);
}
return Uri.withAppendedPath(channelUri, Channels.Logo.CONTENT_DIRECTORY);
|
public static final android.net.Uri | buildChannelUri(long channelId)Builds a URI that points to a specific channel.
return ContentUris.withAppendedId(Channels.CONTENT_URI, channelId);
|
public static final android.net.Uri | buildChannelUriForPassthroughInput(java.lang.String inputId)Build a special channel URI intended to be used with pass-through inputs. (e.g. HDMI)
return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY)
.appendPath(PATH_PASSTHROUGH).appendPath(inputId).build();
|
public static final android.net.Uri | buildChannelsUriForInput(java.lang.String inputId)Builds a URI that points to all channels from a given TV input.
return buildChannelsUriForInput(inputId, false);
|
public static final android.net.Uri | buildChannelsUriForInput(java.lang.String inputId, boolean browsableOnly)Builds a URI that points to all or browsable-only channels from a given TV input.
Uri.Builder builder = Channels.CONTENT_URI.buildUpon();
if (inputId != null) {
builder.appendQueryParameter(PARAM_INPUT, inputId);
}
return builder.appendQueryParameter(PARAM_BROWSABLE_ONLY, String.valueOf(browsableOnly))
.build();
|
public static final android.net.Uri | buildChannelsUriForInput(java.lang.String inputId, java.lang.String genre, boolean browsableOnly)Builds a URI that points to all or browsable-only channels which have programs with the given
genre from the given TV input.
if (genre == null) {
return buildChannelsUriForInput(inputId, browsableOnly);
}
if (!Programs.Genres.isCanonical(genre)) {
throw new IllegalArgumentException("Not a canonical genre: '" + genre + "'");
}
return buildChannelsUriForInput(inputId, browsableOnly).buildUpon()
.appendQueryParameter(PARAM_CANONICAL_GENRE, genre).build();
|
public static final java.lang.String | buildInputId(android.content.ComponentName name)Builds an ID that uniquely identifies a TV input service.
return name.flattenToShortString();
|
public static final android.net.Uri | buildProgramUri(long programId)Builds a URI that points to a specific program.
return ContentUris.withAppendedId(Programs.CONTENT_URI, programId);
|
public static final android.net.Uri | buildProgramsUriForChannel(long channelId)Builds a URI that points to all programs on a given channel.
return Programs.CONTENT_URI.buildUpon()
.appendQueryParameter(PARAM_CHANNEL, String.valueOf(channelId)).build();
|
public static final android.net.Uri | buildProgramsUriForChannel(android.net.Uri channelUri)Builds a URI that points to all programs on a given channel.
if (!isChannelUriForTunerInput(channelUri)) {
throw new IllegalArgumentException("Not a channel: " + channelUri);
}
return buildProgramsUriForChannel(ContentUris.parseId(channelUri));
|
public static final android.net.Uri | buildProgramsUriForChannel(long channelId, long startTime, long endTime)Builds a URI that points to programs on a specific channel whose schedules overlap with the
given time frame.
Uri uri = buildProgramsUriForChannel(channelId);
return uri.buildUpon().appendQueryParameter(PARAM_START_TIME, String.valueOf(startTime))
.appendQueryParameter(PARAM_END_TIME, String.valueOf(endTime)).build();
|
public static final android.net.Uri | buildProgramsUriForChannel(android.net.Uri channelUri, long startTime, long endTime)Builds a URI that points to programs on a specific channel whose schedules overlap with the
given time frame.
if (!isChannelUriForTunerInput(channelUri)) {
throw new IllegalArgumentException("Not a channel: " + channelUri);
}
return buildProgramsUriForChannel(ContentUris.parseId(channelUri), startTime, endTime);
|
public static final android.net.Uri | buildWatchedProgramUri(long watchedProgramId)Builds a URI that points to a specific program the user watched.
return ContentUris.withAppendedId(WatchedPrograms.CONTENT_URI, watchedProgramId);
|
public static final boolean | isChannelUri(android.net.Uri uri)Returns true, if {@code uri} is a channel URI.
return isChannelUriForTunerInput(uri) || isChannelUriForPassthroughInput(uri);
|
public static final boolean | isChannelUriForPassthroughInput(android.net.Uri uri)Returns true, if {@code uri} is a channel URI for a passthrough input.
return isTvUri(uri) && isTwoSegmentUriStartingWith(uri, PATH_PASSTHROUGH);
|
public static final boolean | isChannelUriForTunerInput(android.net.Uri uri)Returns true, if {@code uri} is a channel URI for a tuner input.
return isTvUri(uri) && isTwoSegmentUriStartingWith(uri, PATH_CHANNEL);
|
public static final boolean | isProgramUri(android.net.Uri uri)Returns true, if {@code uri} is a program URI.
return isTvUri(uri) && isTwoSegmentUriStartingWith(uri, PATH_PROGRAM);
|
private static final boolean | isTvUri(android.net.Uri uri)
return uri != null && ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())
&& AUTHORITY.equals(uri.getAuthority());
|
private static final boolean | isTwoSegmentUriStartingWith(android.net.Uri uri, java.lang.String pathSegment)
List<String> pathSegments = uri.getPathSegments();
return pathSegments.size() == 2 && pathSegment.equals(pathSegments.get(0));
|