本文整理汇总了Java中com.google.samples.apps.iosched.Config.CONFERENCE_START_MILLIS属性的典型用法代码示例。如果您正苦于以下问题:Java Config.CONFERENCE_START_MILLIS属性的具体用法?Java Config.CONFERENCE_START_MILLIS怎么用?Java Config.CONFERENCE_START_MILLIS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.samples.apps.iosched.Config
的用法示例。
在下文中一共展示了Config.CONFERENCE_START_MILLIS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateRecommendedSyncInterval
private static long calculateRecommendedSyncInterval(final Context context) {
long now = UIUtils.getCurrentTime(context);
long aroundConferenceStart = Config.CONFERENCE_START_MILLIS
- Config.AUTO_SYNC_AROUND_CONFERENCE_THRESH;
if (now < aroundConferenceStart) {
return Config.AUTO_SYNC_INTERVAL_LONG_BEFORE_CONFERENCE;
} else if (now <= Config.CONFERENCE_END_MILLIS) {
return Config.AUTO_SYNC_INTERVAL_AROUND_CONFERENCE;
} else {
return Config.AUTO_SYNC_INTERVAL_AFTER_CONFERENCE;
}
}
示例2: checkShowStaleDataButterBar
private void checkShowStaleDataButterBar() {
final boolean showingFilters = findViewById(R.id.filters_box) != null
&& findViewById(R.id.filters_box).getVisibility() == View.VISIBLE;
final long now = UIUtils.getCurrentTime(this);
final boolean inSnooze = (now - mLastDataStaleUserActionTime < Config.STALE_DATA_WARNING_SNOOZE);
final long staleTime = now - PrefUtils.getLastSyncSucceededTime(this);
final long staleThreshold = (now >= Config.CONFERENCE_START_MILLIS && now
<= Config.CONFERENCE_END_MILLIS) ? Config.STALE_DATA_THRESHOLD_DURING_CONFERENCE :
Config.STALE_DATA_THRESHOLD_NOT_DURING_CONFERENCE;
final boolean isStale = (staleTime >= staleThreshold);
final boolean bootstrapDone = PrefUtils.isDataBootstrapDone(this);
final boolean mustShowBar = bootstrapDone && isStale && !inSnooze && !showingFilters;
if (!mustShowBar) {
mButterBar.setVisibility(View.GONE);
} else {
UIUtils.setUpButterBar(mButterBar, getString(R.string.data_stale_warning),
getString(R.string.description_refresh), new View.OnClickListener() {
@Override
public void onClick(View v) {
mButterBar.setVisibility(View.GONE);
updateFragContentTopClearance();
mLastDataStaleUserActionTime = UIUtils.getCurrentTime(
BrowseSessionsActivity.this);
requestDataRefresh();
}
}
);
}
updateFragContentTopClearance();
}
示例3: calculateRecommendedSyncInterval
public static long calculateRecommendedSyncInterval(final Context context) {
long now = UIUtils.getCurrentTime(context);
long aroundConferenceStart = Config.CONFERENCE_START_MILLIS - Config.AUTO_SYNC_AROUND_CONFERENCE_THRESH;
if (now < aroundConferenceStart) {
return Config.AUTO_SYNC_INTERVAL_LONG_BEFORE_CONFERENCE;
} else if (now <= Config.CONFERENCE_END_MILLIS) {
return Config.AUTO_SYNC_INTERVAL_AROUND_CONFERENCE;
} else {
return Config.AUTO_SYNC_INTERVAL_AFTER_CONFERENCE;
}
}
示例4: 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;
}
示例5: setCurrentTimeRelativeToStartOfConference
/**
* Sets the current time to a time relative to the start of the conference. If {@code
* timeDifference} is positive, it is set to {@code timeDifference} ms after the start of the
* conference, if it is negative, it is set to {@code timeDifference} ms before the start of the
* conference. This should only be called from code in debug package or in tests.
*/
public static void setCurrentTimeRelativeToStartOfConference(Context context,
long timeDifference) {
java.util.Date newTime =
new java.util.Date(Config.CONFERENCE_START_MILLIS + timeDifference);
TimeUtils.setCurrentTime(context, newTime.getTime());
}
示例6: calculateRecommendedSyncInterval
private static long calculateRecommendedSyncInterval(final Context context) {
long now = TimeUtils.getCurrentTime(context);
long aroundConferenceStart = Config.CONFERENCE_START_MILLIS
- Config.AUTO_SYNC_AROUND_CONFERENCE_THRESH;
if (now < aroundConferenceStart) {
return Config.AUTO_SYNC_INTERVAL_LONG_BEFORE_CONFERENCE;
} else if (now <= Config.CONFERENCE_END_MILLIS) {
return Config.AUTO_SYNC_INTERVAL_AROUND_CONFERENCE;
} else {
return Config.AUTO_SYNC_INTERVAL_AFTER_CONFERENCE;
}
}
示例7: setTime
@Before
public void setTime() {
// Set up time to 5 minutes after end of session
long timeDiff = SessionsMockCursor.END_SESSION - Config.CONFERENCE_START_MILLIS
+ 5 * TimeUtils.MINUTE;
TimeUtils.setCurrentTimeRelativeToStartOfConference(
InstrumentationRegistry.getTargetContext(), timeDiff);
}
示例8: setTime
@Before
public void setTime() {
// Set up time to 9 minutes before start of session
long timeDiff = SessionsMockCursor.START_SESSION - Config.CONFERENCE_START_MILLIS
- 9 * TimeUtils.MINUTE;
TimeUtils.setCurrentTimeRelativeToStartOfConference(
InstrumentationRegistry.getTargetContext(), timeDiff);
}
示例9: setTime
@Before
public void setTime() {
// Set up time to 5 minutes after start of session
long timeDiff = SessionsMockCursor.START_SESSION - Config.CONFERENCE_START_MILLIS
+ 5 * TimeUtils.MINUTE;
TimeUtils.setCurrentTimeRelativeToStartOfConference(
InstrumentationRegistry.getTargetContext(), timeDiff);
}
示例10: constructStartEndAndLivestream
/**
* Builds session details based on whether the session at {@code index} should be {@code
* livestreamened} {@code now}.
*
* @return A String array with 3 elements. The first is the started date, the second is the end
* date, and the third is the livestream url.
*/
private static String[] constructStartEndAndLivestream(boolean[] livestreamed, long now,
int index) {
String livestreamUrl = livestreamed != null && livestreamed[index] ? LIVESTREAM_URL : null;
long start = livestreamUrl != null ? now :
Config.CONFERENCE_START_MILLIS + index * now + TimeUtils.HOUR;
long end = start + TimeUtils.HOUR;
return new String[]{"" + start, "" + end, livestreamUrl};
}
示例11: getItemsForAttendee
/**
* Generates the schedule items for one day of the conference, including the keynote and 1
* session at 12PM with title {@code title}. The user attends the conference and the time is
* set to before the conference.
*
* @param dayId Pass in 1 for the first day, 2 for the second etc
* @param title The title of the non keynote session
* @param feedbackGiven Whether feedback has been given for the session
* @return the schedule items
*/
public static ArrayList<ScheduleItem> getItemsForAttendee(int dayId, boolean feedbackGiven,
String title) {
long timeBase = Config.CONFERENCE_START_MILLIS + (dayId - 1) * TimeUtils.DAY;
ArrayList<ScheduleItem> newItems = new ArrayList<>();
ScheduleItem newItem1 = new ScheduleItem();
newItem1.type = 1;
newItem1.sessionType = 1;
newItem1.mainTag = "FLAG_KEYNOTE";
newItem1.startTime = timeBase;
newItem1.endTime = timeBase + TimeUtils.HOUR;
newItem1.sessionId = "__keynote__";
newItem1.title = "Keynote";
newItem1.subtitle = "Keynote Room (L3)";
newItem1.room = "Keynote Room (L3)";
newItem1.hasGivenFeedback = true;
newItem1.backgroundImageUrl =
"https://storage.googleapis.com/io2015-data.appspot.com/images/sessions/__w-200-" +
"400-600-800-1000__/14f5088b-d0e2-e411-b87f-00155d5066d7.jpg";
newItem1.backgroundColor = -12627531;
newItem1.flags = 1;
newItems.add(newItem1);
ScheduleItem newItem2 = new ScheduleItem();
newItem2.type = 1;
newItem2.sessionType = 2;
newItem2.startTime = timeBase + SESSION_TITLE_AFTER_START_OFFSET;
newItem2.endTime = timeBase + SESSION_TITLE_AFTER_START_OFFSET + 1 * TimeUtils.HOUR;
newItem2.sessionId = SESSION_ID;
newItem2.title = title;
newItem2.subtitle = "Develop Sandbox (L2)";
newItem2.room = "Develop Sandbox (L2)";
newItem2.hasGivenFeedback = feedbackGiven;
newItem2.backgroundImageUrl =
"https://storage.googleapis.com/io2015-data.appspot.com/images/sessions/__w-200-" +
"400-600-800-1000__/ac8d5cc7-36e5-e411-b87f-00155d5066d7.jpg";
newItem2.backgroundColor = -14235942;
newItems.add(newItem2);
return newItems;
}
示例12: startTimeToDayIndex_BeforeStart_ReturnsZero
@Test
public void startTimeToDayIndex_BeforeStart_ReturnsZero() {
// Given a start time 24 hours before the start of the conference
long startTime = Config.CONFERENCE_START_MILLIS - TimeUtils.HOUR * 24;
// When getting the day index for the start time
int index = UIUtils.startTimeToDayIndex(startTime);
// Then the index is 0
assertThat(index, is(0));
}
示例13: startTimeToDayIndex_FirstDay_ReturnsZero
@Test
public void startTimeToDayIndex_FirstDay_ReturnsZero() {
// Given a start time 1 hour after the start of the conference
long startTime = Config.CONFERENCE_START_MILLIS + 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));
}
示例14: isConferenceInProgress
public static boolean isConferenceInProgress(final Context context) {
long now = UIUtils.getCurrentTime(context);
return now >= Config.CONFERENCE_START_MILLIS && now <= Config.CONFERENCE_END_MILLIS;
}
示例15: hasConferenceStarted
public static boolean hasConferenceStarted(final Context context) {
long now = UIUtils.getCurrentTime(context);
return now >= Config.CONFERENCE_START_MILLIS;
}