本文整理汇总了Java中com.google.samples.apps.iosched.util.UIUtils.startTimeToDayIndex方法的典型用法代码示例。如果您正苦于以下问题:Java UIUtils.startTimeToDayIndex方法的具体用法?Java UIUtils.startTimeToDayIndex怎么用?Java UIUtils.startTimeToDayIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.samples.apps.iosched.util.UIUtils
的用法示例。
在下文中一共展示了UIUtils.startTimeToDayIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindView
import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
ImageView thumbnailView = (ImageView) view.findViewById(R.id.thumbnail);
ImageView inScheduleIndicator =
(ImageView) view.findViewById(R.id.indicator_in_schedule);
TextView titleView = (TextView) view.findViewById(R.id.title);
TextView infoView = (TextView) view.findViewById(R.id.info_view);
TextView sessionTypeView = (TextView) view.findViewById(R.id.session_type_text);
titleView.setText(cursor.getString(ExploreSessionsQuery.TITLE));
// Format: Day 1/ 9:00 AM - 11:00 AM/ Room 1
String room = cursor.getString(ExploreSessionsQuery.ROOM_NAME);
long startTime = cursor.getLong(ExploreSessionsQuery.SESSION_START);
long endTime = cursor.getLong(ExploreSessionsQuery.SESSION_END);
int day = UIUtils.startTimeToDayIndex(startTime);
if (day == 0) {
// We have a problem!
LOGE(TAG, "Invalid Day for Session: " +
cursor.getString(ExploreSessionsQuery.SESSION_ID) + " " +
" startTime " + new Date(startTime));
}
String tags = cursor.getString(ExploreSessionsQuery.TAGS);
if (mTagMetadata != null) {
TagMetadata.Tag groupTag = mTagMetadata.getSessionGroupTag(tags.split(","));
sessionTypeView.setText(groupTag == null ? "" : groupTag.getName());
}
String infoText = "";
if (day != 0) {
final Date startDate = new Date(startTime);
infoText = getString(R.string.explore_sessions_show_day_hour_and_room,
TimeUtils.formatShortDate(getActivity(), startDate),
getString(R.string.explore_sessions_show_day_n, day),
TimeUtils.formatShortTime(getActivity(), startDate),
TimeUtils.formatShortTime(getActivity(), new Date(endTime)),
room != null ? room : context.getString(R.string.unknown_room));
}
infoView.setText(infoText);
String thumbUrl = cursor.getString(ExploreSessionsQuery.PHOTO_URL);
view.setTag(cursor.getString(ExploreSessionsQuery.SESSION_ID));
if (TextUtils.isEmpty(thumbUrl)) {
thumbnailView.setImageResource(R.drawable.io_logo);
} else {
mImageLoader.loadImage(thumbUrl, thumbnailView);
}
inScheduleIndicator.setVisibility(
cursor.getLong(ExploreSessionsQuery.IN_MY_SCHEDULE) == 1L ? View.VISIBLE
: View.GONE);
}