当前位置: 首页>>代码示例>>Java>>正文


Java UIUtils.getCurrentTime方法代码示例

本文整理汇总了Java中com.google.samples.apps.iosched.util.UIUtils.getCurrentTime方法的典型用法代码示例。如果您正苦于以下问题:Java UIUtils.getCurrentTime方法的具体用法?Java UIUtils.getCurrentTime怎么用?Java UIUtils.getCurrentTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.samples.apps.iosched.util.UIUtils的用法示例。


在下文中一共展示了UIUtils.getCurrentTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scheduleFeedbackAlarm

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
public void scheduleFeedbackAlarm(final long sessionEnd,
        final long alarmOffset, final String sessionTitle) {
    // By default, feedback alarms fire 5 minutes before session end time. If alarm offset is
    // provided, alarm is set to go off that much time from now (useful for testing).
    long alarmTime;
    if (alarmOffset == UNDEFINED_ALARM_OFFSET) {
        alarmTime = sessionEnd - MILLI_FIVE_MINUTES;
    } else {
        alarmTime = UIUtils.getCurrentTime(this) + alarmOffset;
    }

    LOGD(TAG, "Scheduling session feedback alarm for session '" + sessionTitle + "'");
    LOGD(TAG, "  -> end time: " + sessionEnd + " = " + (new Date(sessionEnd)).toString());
    LOGD(TAG, "  -> alarm time: " + alarmTime + " = " + (new Date(alarmTime)).toString());

    final Intent feedbackIntent = new Intent(
            ACTION_NOTIFY_SESSION_FEEDBACK,
            null,
            this,
            SessionAlarmService.class);
    PendingIntent pi = PendingIntent.getService(
            this, 1, feedbackIntent, PendingIntent.FLAG_CANCEL_CURRENT);
    final AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
    am.set(AlarmManager.RTC_WAKEUP, alarmTime, pi);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:26,代码来源:SessionAlarmService.java

示例2: onCreateLoader

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (id != QUERY_TOKEN_SESSION_ROOM && id != QUERY_TOKEN_SUBTITLE) {
        return null;
    }

    final long time = UIUtils.getCurrentTime(getActivity());
    final String roomId = args.getString(QUERY_ARG_ROOMID);
    final String roomTitle = args.getString(QUERY_ARG_ROOMTITLE);
    final int roomType = args.getInt(QUERY_ARG_ROOMTYPE);

    if (id == QUERY_TOKEN_SESSION_ROOM) {
        return new OverviewSessionLoader(getActivity(), roomId, roomTitle, roomType, time);
    } else if (id == QUERY_TOKEN_SUBTITLE) {
        return new SingleSessionLoader(getActivity(), roomId, roomTitle, roomType);
    }
    return null;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:MapInfoFragment.java

示例3: onPostCreate

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
@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()));
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:18,代码来源:MyScheduleActivity.java

示例4: onCreateLoader

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    switch (id) {
        case SessionSummaryQuery._TOKEN:
            return new CursorLoader(this, Sessions.buildSessionUri(mSessionId),
                    SessionSummaryQuery.PROJECTION, null, null, null);
        case SessionsQuery._TOKEN:
            boolean futureSessions = false;
            if (args != null) {
                futureSessions = args.getBoolean(LOADER_SESSIONS_ARG, false);
            }
            final long currentTime = UIUtils.getCurrentTime(this);
            String selection = Sessions.LIVESTREAM_SELECTION + " and ";
            String[] selectionArgs;
            if (!futureSessions) {
                selection += Sessions.AT_TIME_SELECTION;
                selectionArgs = Sessions.buildAtTimeSelectionArgs(currentTime);
            } else {
                selection += Sessions.UPCOMING_LIVE_SELECTION;
                selectionArgs = Sessions.buildUpcomingSelectionArgs(currentTime);
            }
            return new CursorLoader(this, Sessions.CONTENT_URI, SessionsQuery.PROJECTION,
                    selection, selectionArgs, SessionsQuery.SORT_ORDER);
    }
    return null;
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:27,代码来源:SessionLivestreamActivity.java

示例5: loadSessionSummary

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
/**
 * Load the session summary info for the currently selected live session.
 */
private void loadSessionSummary(Cursor data) {
    if (data != null && data.moveToFirst()) {
        mCaptionsUrl = data.getString(SessionSummaryQuery.CAPTIONS_URL);
        final long currentTime = UIUtils.getCurrentTime(this);
        if (currentTime > data.getLong(SessionSummaryQuery.SESSION_END)) {
            getLoaderManager().restartLoader(SessionsQuery._TOKEN, null, this);
            return;
        }
        updateSessionViews(
                data.getString(SessionSummaryQuery.LIVESTREAM_URL),
                data.getString(SessionSummaryQuery.TITLE),
                data.getString(SessionSummaryQuery.ABSTRACT),
                data.getString(SessionSummaryQuery.HASHTAGS),
                mCaptionsUrl);
    }
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:20,代码来源:SessionLivestreamActivity.java

示例6: minutesSinceSessionStarted

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
/**
 * Returns the number of minutes, rounded down, since session has started, or 0 if not started
 * yet.
 */
public long minutesSinceSessionStarted() {
    if (!hasSessionStarted()) {
        return 0l;
    } else {
        long currentTimeMillis = UIUtils.getCurrentTime(mContext);
        // Rounded down number of minutes.
        return (currentTimeMillis - mSessionStart) / 60000;
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:14,代码来源:SessionDetailModel.java

示例7: minutesUntilSessionStarts

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
/**
 * Returns the number of minutes, rounded up, until session stars, or 0 if already started.
 */
public long minutesUntilSessionStarts() {
    if (hasSessionStarted()) {
        return 0l;
    } else {
        long currentTimeMillis = UIUtils.getCurrentTime(mContext);
        // Rounded up number of minutes.
        return (mSessionStart - currentTimeMillis) / 60000 + 1;
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:13,代码来源:SessionDetailModel.java

示例8: rewriteKeynoteDetails

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
private void rewriteKeynoteDetails(SessionData keynoteData) {
    long startTime, endTime, currentTime;
    currentTime = UIUtils.getCurrentTime(mContext);
    if (keynoteData.getStartDate() != null) {
        startTime = keynoteData.getStartDate().getTime();
    } else {
        LOGD(TAG, "Keynote start time wasn't set");
        startTime = 0;
    }
    if (keynoteData.getEndDate() != null) {
        endTime = keynoteData.getEndDate().getTime();
    } else {
        LOGD(TAG, "Keynote end time wasn't set");
        endTime = Long.MAX_VALUE;
    }

    StringBuilder stringBuilder = new StringBuilder();
    if (currentTime >= startTime && currentTime < endTime) {
        stringBuilder.append(mContext.getString(R.string
                .live_now));
    } else {
        String shortDate = TimeUtils.formatShortDate(mContext, keynoteData.getStartDate());
        stringBuilder.append(shortDate);

        if (startTime > 0) {
            stringBuilder.append(" / " );
            stringBuilder.append(TimeUtils.formatShortTime(mContext,
                    new java.util.Date(startTime)));
        }
    }
    keynoteData.setDetails(stringBuilder.toString());
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:33,代码来源:ExploreModel.java

示例9: enableActiveCards

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
/**
 * Mark appropriate cards active.
 *
 * @param context Context to be used to lookup the {@link android.content.SharedPreferences}.
 */
public static void enableActiveCards(final Context context) {
    long currentTime = UIUtils.getCurrentTime(context);
    for (ConfMessageCard card : ConfMessageCard.values()) {
        if (card.isActive(currentTime)) {
            markShouldShowConfMessageCard(context, card, true);
        }
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:14,代码来源:ConfMessageCardUtils.java

示例10: getItemViewType

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
public int getItemViewType(int position) {
    if (position < 0 || position >= mScheduleItems.size()) {
        LOGE(TAG, "Invalid view position passed to MyScheduleAdapter: " + position);
        return VIEW_TYPE_NORMAL;
    }
    ScheduleItem item = mScheduleItems.get(position);
    long now = UIUtils.getCurrentTime(mContext);
    if (item.startTime <= now && now <= item.endTime && item.type == ScheduleItem.SESSION) {
        return VIEW_TYPE_NOW;
    } else {
        return VIEW_TYPE_NORMAL;
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:14,代码来源:ScheduleWidgetRemoteViewsService.java

示例11: calculateRecommendedSyncInterval

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:13,代码来源:SyncHelper.java

示例12: checkShowStaleDataButterBar

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
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();
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:32,代码来源:BrowseSessionsActivity.java

示例13: onMarkerClick

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
    final String snippet = marker.getSnippet();
    final String title = marker.getTitle();

    // Log clicks on session and partner markers
    if (TYPE_SESSION.equals(snippet) || TYPE_PARTNER.equals(snippet)) {
        /* [ANALYTICS:EVENT]
         * TRIGGER:   Click on a marker on the map.
         * CATEGORY:  'Map'
         * ACTION:    'markerclick'
         * LABEL:     marker ID (for example room UUID or partner marker id)
         * [/ANALYTICS]
         */
        AnalyticsManager.sendEvent("Map", "markerclick", title, 0L);
    }

    if(marker.equals(mMosconeMaker)){
        // Return camera to Moscone
        LOGD(TAG, "Clicked on Moscone marker, return to initial display.");
        centerOnMoscone(true);
    } else if (TYPE_SESSION.equals(snippet)) {
        final long time = UIUtils.getCurrentTime(getActivity());
        Uri uri = ScheduleContract.Sessions.buildSessionsInRoomAfterUri(title, time);
        final String order = ScheduleContract.Sessions.SESSION_START + " ASC";

        mQueryHandler.startQuery(SessionAfterQuery._TOKEN, title, uri,
                SessionAfterQuery.PROJECTION, null, null, order);
    } else if (TYPE_PARTNER.equals(snippet)) {
        mCallbacks.onShowPartners();
    } else if (TYPE_PLAIN_SESSION.equals(snippet)) {
        // Show a basic info window with a title only
        marker.showInfoWindow();
    }
    // ignore other markers

    //centerMap(marker.getPosition());
    return true;
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:40,代码来源:MapFragment.java

示例14: onStop

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
@Override
public void onStop() {
    super.onStop();
    if (mInitStarred != mStarred) {
        if (UIUtils.getCurrentTime(this) < mSessionStart) {
            // Update Calendar event through the Calendar API on Android 4.0 or new versions.
            Intent intent = null;
            if (mStarred) {
                // Set up intent to add session to Calendar, if it doesn't exist already.
                intent = new Intent(SessionCalendarService.ACTION_ADD_SESSION_CALENDAR,
                        mSessionUri);
                intent.putExtra(SessionCalendarService.EXTRA_SESSION_START,
                        mSessionStart);
                intent.putExtra(SessionCalendarService.EXTRA_SESSION_END,
                        mSessionEnd);
                intent.putExtra(SessionCalendarService.EXTRA_SESSION_ROOM, mRoomName);
                intent.putExtra(SessionCalendarService.EXTRA_SESSION_TITLE, mTitleString);
            } else {
                // Set up intent to remove session from Calendar, if exists.
                intent = new Intent(SessionCalendarService.ACTION_REMOVE_SESSION_CALENDAR,
                        mSessionUri);
                intent.putExtra(SessionCalendarService.EXTRA_SESSION_START,
                        mSessionStart);
                intent.putExtra(SessionCalendarService.EXTRA_SESSION_END,
                        mSessionEnd);
                intent.putExtra(SessionCalendarService.EXTRA_SESSION_TITLE, mTitleString);
            }
            intent.setClass(this, SessionCalendarService.class);
            startService(intent);

            if (mStarred) {
                setupNotification();
            }
        }
    }
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:37,代码来源:SessionDetailActivity.java

示例15: setupNotification

import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
private void setupNotification() {
    Intent scheduleIntent;

    // Schedule session notification
    if (UIUtils.getCurrentTime(this) < mSessionStart) {
        LOGD(TAG, "Scheduling notification about session start.");
        scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_STARRED_BLOCK,
                null, this, SessionAlarmService.class);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_START, mSessionStart);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_END, mSessionEnd);
        startService(scheduleIntent);
    } else {
        LOGD(TAG, "Not scheduling notification about session start, too late.");
    }

    // Schedule feedback notification
    if (UIUtils.getCurrentTime(this) < mSessionEnd) {
        LOGD(TAG, "Scheduling notification about session feedback.");
        scheduleIntent = new Intent(
                SessionAlarmService.ACTION_SCHEDULE_FEEDBACK_NOTIFICATION,
                null, this, SessionAlarmService.class);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_ID, mSessionId);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_START, mSessionStart);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_END, mSessionEnd);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_TITLE, mTitleString);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_ROOM, mRoomName);
        scheduleIntent.putExtra(SessionAlarmService.EXTRA_SESSION_SPEAKERS, mSpeakers);
        startService(scheduleIntent);
    } else {
        LOGD(TAG, "Not scheduling feedback notification, too late.");
    }
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:34,代码来源:SessionDetailActivity.java


注:本文中的com.google.samples.apps.iosched.util.UIUtils.getCurrentTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。