本文整理汇总了Java中android.media.tv.TvContract.Programs.COLUMN_END_TIME_UTC_MILLIS属性的典型用法代码示例。如果您正苦于以下问题:Java Programs.COLUMN_END_TIME_UTC_MILLIS属性的具体用法?Java Programs.COLUMN_END_TIME_UTC_MILLIS怎么用?Java Programs.COLUMN_END_TIME_UTC_MILLIS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.media.tv.TvContract.Programs
的用法示例。
在下文中一共展示了Programs.COLUMN_END_TIME_UTC_MILLIS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLastProgramEndTimeMillis
public static long getLastProgramEndTimeMillis(ContentResolver resolver, Uri channelUri) {
Uri uri = TvContract.buildProgramsUriForChannel(channelUri);
String[] projection = {Programs.COLUMN_END_TIME_UTC_MILLIS};
Cursor cursor = null;
try {
// TvProvider returns programs chronological order by default.
cursor = resolver.query(uri, projection, null, null, null);
if (cursor == null || cursor.getCount() == 0) {
return 0;
}
cursor.moveToLast();
return cursor.getLong(0);
} catch (Exception e) {
Log.w(TAG, "Unable to get last program end time for " + channelUri, e);
} finally {
if (cursor != null) {
cursor.close();
}
}
return 0;
}
示例2: fillProgramInfo
/**
* Replaces the channel information - title, description, channel logo - with the current
* program information of the channel if the current program information exists and it is not
* blocked.
*/
@WorkerThread
private void fillProgramInfo(SearchResult result) {
long now = System.currentTimeMillis();
Uri uri = TvContract.buildProgramsUriForChannel(result.channelId, now, now);
String[] projection = new String[] {
Programs.COLUMN_TITLE,
Programs.COLUMN_POSTER_ART_URI,
Programs.COLUMN_CONTENT_RATING,
Programs.COLUMN_VIDEO_WIDTH,
Programs.COLUMN_VIDEO_HEIGHT,
Programs.COLUMN_START_TIME_UTC_MILLIS,
Programs.COLUMN_END_TIME_UTC_MILLIS
};
try (Cursor c = mContentResolver.query(uri, projection, null, null, null)) {
if (c != null && c.moveToNext() && !isRatingBlocked(c.getString(2))) {
String channelName = result.title;
long startUtcMillis = c.getLong(5);
long endUtcMillis = c.getLong(6);
result.title = c.getString(0);
result.description = buildProgramDescription(result.channelNumber, channelName,
startUtcMillis, endUtcMillis);
String imageUri = c.getString(1);
if (imageUri != null) {
result.imageUri = imageUri;
}
result.videoWidth = c.getInt(3);
result.videoHeight = c.getInt(4);
result.duration = endUtcMillis - startUtcMillis;
result.progressPercentage = getProgressPercentage(startUtcMillis, endUtcMillis);
}
}
}
示例3: getLastProgramEndTimeMs
private static long getLastProgramEndTimeMs(
Context context, Uri channelUri, long startTimeMs, long endTimeMs) {
Uri uri = TvContract.buildProgramsUriForChannel(channelUri, startTimeMs, endTimeMs);
String[] projection = {Programs.COLUMN_END_TIME_UTC_MILLIS};
try (Cursor cursor =
context.getContentResolver().query(uri, projection, null, null, null)) {
if (cursor != null && cursor.moveToLast()) {
return cursor.getLong(0);
}
}
return 0;
}
示例4: buildRatingInfo
public static RatingInfo buildRatingInfo(Context context, ChannelDescriptor channel) {
if (channel == null) {
return null;
}
Uri uri = TvContract.buildProgramsUriForChannel(channel.getChannelId());
String time = String.valueOf(System.currentTimeMillis());
String selection = Programs.COLUMN_START_TIME_UTC_MILLIS + "<=? AND "
+ Programs.COLUMN_END_TIME_UTC_MILLIS + ">?";
String[] args = {
time, time
};
Cursor cursor = null;
//Sometimes TIF service will throw exception when trying to use selection on programs table
try {
cursor = context.getContentResolver().query(uri, null, selection, args, null);
} catch (Exception e) {
e.printStackTrace();
}
long eventEndTime = 0;
String eventRating = null;
mLog.d("CRR - id=" + channel.getChannelId());
mLog.d("CRR - time=" + time);
if (cursor == null) {
mLog.d("CRR - no cursor!");
} else {
mLog.d("CRR - count=" + cursor.getCount());
if (cursor.moveToFirst()) {
eventEndTime = cursor.getLong(cursor.getColumnIndex(
Programs.COLUMN_END_TIME_UTC_MILLIS));
eventRating = cursor.getString(cursor.getColumnIndex(
Programs.COLUMN_CONTENT_RATING));
mLog.d("CRR - event.title="
+ cursor.getString(cursor.getColumnIndex(Programs.COLUMN_TITLE)));
mLog.d("CRR - event.rating=" + eventRating);
mLog.d("CRR - event.endTime=" + eventEndTime);
return new RatingInfo(
(eventRating == null)
? null
: TvContentRating.unflattenFromString(eventRating),
eventEndTime);
}
cursor.close();
}
return null;
}