本文整理汇总了Java中com.google.samples.apps.iosched.model.ScheduleItem.FLAG_HAS_LIVESTREAM属性的典型用法代码示例。如果您正苦于以下问题:Java ScheduleItem.FLAG_HAS_LIVESTREAM属性的具体用法?Java ScheduleItem.FLAG_HAS_LIVESTREAM怎么用?Java ScheduleItem.FLAG_HAS_LIVESTREAM使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.samples.apps.iosched.model.ScheduleItem
的用法示例。
在下文中一共展示了ScheduleItem.FLAG_HAS_LIVESTREAM属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatTime
private String formatTime(long now, ScheduleItem item) {
StringBuilder time = new StringBuilder();
if (item.startTime <= now) {
// session is happening now!
if (0 != (item.flags & ScheduleItem.FLAG_HAS_LIVESTREAM)) {
// session has live stream
time.append(mContext.getString(R.string.watch_now));
} else {
time.append(mContext.getString(R.string.session_now));
}
} else {
// session in the future
time.append(TimeUtils.formatShortTime(mContext, new Date(item.startTime)));
}
time.append(" - ");
time.append(TimeUtils.formatShortTime(mContext, new Date(item.endTime)));
return time.toString();
}
示例2: bind
public void bind(@NonNull ScheduleItem item, @NonNull TagPool tagPool,
@Nullable TagMetadata tagMetadata) {
if (item.type != ScheduleItem.SESSION) {
return;
}
mSession = item;
final Context context = itemView.getContext();
mTitle.setText(item.title);
updateReservationStatus(item);
setDescription(mDescription, item);
mTagsHolder.removeAllViews();
if (tagMetadata != null) {
updateTags(item, tagMetadata, tagPool);
}
boolean isLivestreamed = item.isKeynote()
|| (item.flags & ScheduleItem.FLAG_HAS_LIVESTREAM) != 0;
final long now = TimeUtils.getCurrentTime(context);
final boolean streamingNow = isLivestreamed && item.startTime <= now && now <= item.endTime;
if (isLivestreamed && !streamingNow) {
if (mTagsHolder.getChildCount() > 0) {
// Insert the spacer first
mTagsHolder.addView(tagPool.getSpacer(mTagsHolder));
}
mTagsHolder.addView(tagPool.getLivestream(mTagsHolder));
}
mTagsHolder.setVisibility(mTagsHolder.getChildCount() > 0 ? VISIBLE : GONE);
if (mCallbacks.bookmarkingEnabled() && !item.isKeynote()) {
mBookmark.setVisibility(VISIBLE);
// activated is proxy for in-schedule
mBookmark.setActivated(item.inSchedule);
} else {
mBookmark.setVisibility(GONE);
}
mLiveNow.setVisibility(streamingNow ? VISIBLE : GONE);
boolean showFeedback = mCallbacks.feedbackEnabled()
&& (now >= item.endTime && !item.hasGivenFeedback);
mRate.setVisibility(showFeedback ? VISIBLE : GONE);
}