本文整理汇总了Java中com.google.samples.apps.iosched.Config.CONFERENCE_DAYS属性的典型用法代码示例。如果您正苦于以下问题:Java Config.CONFERENCE_DAYS属性的具体用法?Java Config.CONFERENCE_DAYS怎么用?Java Config.CONFERENCE_DAYS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.samples.apps.iosched.Config
的用法示例。
在下文中一共展示了Config.CONFERENCE_DAYS属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPostCreate
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
if (mViewPager != null) {
long now = UIUtils.getCurrentTime(this);
selectDay(0);
for (int i = 0; i < Config.CONFERENCE_DAYS.length; i++) {
if (now >= Config.CONFERENCE_DAYS[i][0] && now <= Config.CONFERENCE_DAYS[i][1]) {
selectDay(i);
break;
}
}
}
setProgressBarTopWhenActionBarShown((int)
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2,
getResources().getDisplayMetrics()));
}
示例2: onPostCreate
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
if (mViewPager != null) {
long now = UIUtils.getCurrentTime(this);
for (int i = 0; i < Config.CONFERENCE_DAYS.length; i++) {
if (now >= Config.CONFERENCE_DAYS[i][0] && now <= Config.CONFERENCE_DAYS[i][1]) {
mViewPager.setCurrentItem(i);
setTimerToUpdateUI(i);
break;
}
}
}
setProgressBarTopWhenActionBarShown((int)
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2,
getResources().getDisplayMetrics()));
}
示例3: startTimeToDayIndex
/**
* @param startTime The start time of a session.
* @return Returns the Day index such as 1 or 2 based on the given start time.
*/
public static int startTimeToDayIndex(long startTime) {
if (startTime <= Config.CONFERENCE_DAYS[0][1] &&
startTime >= Config.CONFERENCE_DAYS[0][0]) {
return 1;
} else if (startTime <= Config.CONFERENCE_DAYS[1][1] &&
startTime >= Config.CONFERENCE_DAYS[1][0]) {
return 2;
}
return 0;
}
示例4: getDayName
private String getDayName(int position) {
if (position >= 0 && position < Config.CONFERENCE_DAYS.length) {
long timestamp = Config.CONFERENCE_DAYS[position][0];
return TimeUtils.formatHumanFriendlyShortDate(this, timestamp);
} else {
return "";
}
}
示例5: calculateCurrentDay
private void calculateCurrentDay() {
final long now = TimeUtils.getCurrentTime(getContext());
// If we are before or after the conference, the first day is considered the current day
mToday = 0;
for (int i = 0; i < Config.CONFERENCE_DAYS.length; i++) {
if (now >= Config.CONFERENCE_DAYS[i][0] && now <= Config.CONFERENCE_DAYS[i][1]) {
// mToday is set to 1 for the first day, 2 for the second etc
mToday = i;
break;
}
}
}
示例6: startTimeToDayIndex
/**
* @param startTime The start time of a session. It is expected to be a start time during the
* conference.
* @return the position in the {@link Config#CONFERENCE_DAYS} of the day of the session at
* {@code startTime}. Note that to avoid possible crashes, the returned index is always a valid
* position in the {@link Config#CONFERENCE_DAYS} array, so if the {@code startTime} is before
* the start of the conference, 0 will be returned, and if it is after the end of the
* conference, the index of the last day will be returned. If the time is outside of the
* start/end times of a conference day, for example at 5am, it returns 0.
*/
public static int startTimeToDayIndex(long startTime) {
if (startTime < Config.CONFERENCE_START_MILLIS) {
return 0;
} else if (startTime > Config.CONFERENCE_END_MILLIS) {
return Config.CONFERENCE_DAYS.length - 1;
}
for (int i = 0; i < Config.CONFERENCE_DAYS.length; i++) {
if (startTime >=
Config.CONFERENCE_DAYS[i][0] && startTime <= Config.CONFERENCE_DAYS[i][1]) {
return i;
}
}
return 0;
}
示例7: startTimeToDayIndex_OneHourBeforeStartOfLastDay_ReturnsZero
@Test
public void startTimeToDayIndex_OneHourBeforeStartOfLastDay_ReturnsZero() {
// Given a start time 1 hour before the start of the last day of the conference
long startTime =
Config.CONFERENCE_DAYS[Config.CONFERENCE_DAYS.length - 1][0] - TimeUtils.HOUR * 1;
// When getting the day index for the start time
int index = UIUtils.startTimeToDayIndex(startTime);
// Then the index is 0
assertThat(index, is(0));
}
示例8: getDayName
private String getDayName(int position) {
long day1Start = Config.CONFERENCE_DAYS[0][0];
long day = 1000 * 60 * 60 * 24;
return TimeUtils.formatShortDate(this, new Date(day1Start + day * position));
}
示例9: isShowingCurrentDay
private boolean isShowingCurrentDay() {
final long now = TimeUtils.getCurrentTime(getContext());
return mDayId > 0 && now >= Config.CONFERENCE_DAYS[mDayId - 1][0]
&& now <= Config.CONFERENCE_DAYS[mDayId - 1][1];
}
示例10: getDayName
/**
* @return the name of the day at the given {@code position} in the {@link
* Config#CONFERENCE_DAYS}. It is assumed that all days in {@link Config#CONFERENCE_DAYS} are
* consecutive.
*/
public static String getDayName(Context context, int position) {
long day1Start = Config.CONFERENCE_DAYS[0][0];
long day = 1000 * 60 * 60 * 24;
return TimeUtils.formatShortDate(context, new Date(day1Start + day * position));
}
示例11: setCurrentTimeRelativeToStartOfSecondDayOfConference
/**
* Sets the current time to a time relative to the start of the second day of the conference. If
* {@code timeDifference} is positive, it is set to {@code timeDifference} ms after the start of
* the second day of the conference, if it is negative, it is set to {@code timeDifference} ms
* before the start of the second day of the conference. This should only be called from code in
* debug package or in tests.
*/
public static void setCurrentTimeRelativeToStartOfSecondDayOfConference(Context context,
long timeDifference) {
java.util.Date newTime = new java.util.Date(Config.CONFERENCE_DAYS[1][0] + timeDifference);
TimeUtils.setCurrentTime(context, newTime.getTime());
}