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


Java ThreadUtils.postOnUiThreadDelayed方法代码示例

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


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

示例1: onActivityStateChange

import org.chromium.base.ThreadUtils; //导入方法依赖的package包/类
@Override
public void onActivityStateChange(Activity activity, int newState) {
    if (newState == ActivityState.STOPPED) {
        // Exit fullscreen in onStop to ensure the system UI flags are set correctly when
        // showing again (on JB MR2+ builds, the omnibox would be covered by the
        // notification bar when this was done in onStart()).
        setPersistentFullscreenMode(false);
    } else if (newState == ActivityState.STARTED) {
        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
            @Override
            public void run() {
                mBrowserVisibilityDelegate.showControlsTransient();
            }
        }, ACTIVITY_RETURN_SHOW_REQUEST_DELAY_MS);
    } else if (newState == ActivityState.DESTROYED) {
        ApplicationStatus.unregisterActivityStateListener(this);
        ((BaseChromiumApplication) mWindow.getContext().getApplicationContext())
                .unregisterWindowFocusChangedListener(this);

        mTabModelObserver.destroy();
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:ChromeFullscreenManager.java

示例2: captureNavigationInfo

import org.chromium.base.ThreadUtils; //导入方法依赖的package包/类
private void captureNavigationInfo(final Tab tab) {
    if (mCustomTabsConnection == null) return;
    if (!mCustomTabsConnection.shouldSendNavigationInfoForSession(mSession)) return;

    final ContentBitmapCallback callback = new ContentBitmapCallback() {
        @Override
        public void onFinishGetBitmap(Bitmap bitmap, int response) {
            if (TextUtils.isEmpty(tab.getTitle()) && bitmap == null) return;
            mCustomTabsConnection.sendNavigationInfo(
                    mSession, tab.getUrl(), tab.getTitle(), bitmap);
        }
    };
    // Delay screenshot capture since the page might be doing post load tasks. And this also
    // gives time to get rid of any redirects and avoid capturing screenshots for those.
    ThreadUtils.postOnUiThreadDelayed(new Runnable() {
        @Override
        public void run() {
            if (!tab.isHidden() && mCurrentState != STATE_RESET) return;
            if (tab.getWebContents() == null) return;
            tab.getWebContents().getContentBitmapAsync(
                    Bitmap.Config.ARGB_8888, mScaleForNavigationInfo, new Rect(), callback);
            mScreenshotTakenForCurrentNavigation = true;
        }
    }, 1000);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:26,代码来源:CustomTabObserver.java

示例3: finishAndClose

import org.chromium.base.ThreadUtils; //导入方法依赖的package包/类
/**
 * Finishes the activity and removes the reference from the Android recents.
 *
 * @param reparenting true iff the activity finishes due to tab reparenting.
 */
public final void finishAndClose(boolean reparenting) {
    mIsClosing = true;
    if (!reparenting) {
        // Closing the activity destroys the renderer as well. Re-create a spare renderer some
        // time after, so that we have one ready for the next tab open. This does not increase
        // memory consumption, as the current renderer goes away. We create a renderer as a lot
        // of users open several Custom Tabs in a row. The delay is there to avoid jank in the
        // transition animation when closing the tab.
        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
            @Override
            public void run() {
                WarmupManager.getInstance().createSpareWebContents();
            }
        }, 500);
    }

    handleFinishAndClose();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:CustomTabActivity.java

示例4: setTitleToPageTitle

import org.chromium.base.ThreadUtils; //导入方法依赖的package包/类
@Override
public void setTitleToPageTitle() {
    Tab currentTab = getToolbarDataProvider().getTab();
    if (currentTab == null || TextUtils.isEmpty(currentTab.getTitle())) {
        mTitleBar.setText("");
        return;
    }
    String title = currentTab.getTitle();

    // It takes some time to parse the title of the webcontent, and before that Tab#getTitle
    // always return the url. We postpone the title animation until the title is authentic.
    if ((mState == STATE_DOMAIN_AND_TITLE || mState == STATE_TITLE_ONLY)
            && !title.equals(currentTab.getUrl())
            && !title.equals(UrlConstants.ABOUT_BLANK)) {
        // Delay the title animation until security icon animation finishes.
        ThreadUtils.postOnUiThreadDelayed(mTitleAnimationStarter, TITLE_ANIM_DELAY_MS);
    }

    mTitleBar.setText(title);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:CustomTabToolbar.java

示例5: onDeferredStartup

import org.chromium.base.ThreadUtils; //导入方法依赖的package包/类
/**
 * Handle all necessary tasks that can be delayed until initialization completes.
 * @param activityCreationTimeMs The time of creation for the activity this toolbar belongs to.
 * @param activityName Simple class name for the activity this toolbar belongs to.
 */
public void onDeferredStartup(final long activityCreationTimeMs,
        final String activityName) {
    // Record startup performance statistics
    long elapsedTime = SystemClock.elapsedRealtime() - activityCreationTimeMs;
    if (elapsedTime < RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS) {
        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
            @Override
            public void run() {
                onDeferredStartup(activityCreationTimeMs, activityName);
            }
        }, RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS - elapsedTime);
    }
    RecordHistogram.recordTimesHistogram("MobileStartup.ToolbarFirstDrawTime." + activityName,
            mToolbar.getFirstDrawTime() - activityCreationTimeMs, TimeUnit.MILLISECONDS);

    long firstFocusTime = mToolbar.getLocationBar().getFirstUrlBarFocusTime();
    if (firstFocusTime != 0) {
        RecordHistogram.recordCustomTimesHistogram(
                "MobileStartup.ToolbarFirstFocusTime." + activityName,
                firstFocusTime - activityCreationTimeMs, MIN_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS,
                MAX_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS, TimeUnit.MILLISECONDS, 50);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:29,代码来源:ToolbarManager.java

示例6: setOnInitializeAsyncFinished

import org.chromium.base.ThreadUtils; //导入方法依赖的package包/类
/**
 * Sets a callback that will be executed when the initialization is done.
 *
 * @param callback  This is called when the initialization is done.
 * @param timeoutMs If initializing takes more than this time since this function is called,
 *                  force run |callback| early. The unit is ms.
 */
public static void setOnInitializeAsyncFinished(final Runnable callback, long timeoutMs) {
    sInitializeAsyncCallbacks.add(callback);

    ThreadUtils.postOnUiThreadDelayed(
            new Runnable() {
                @Override
                public void run() {
                    if (sInitializeAsyncCallbacks.remove(callback)) callback.run();
                }
            },
            sIsInitialized ? 0 : timeoutMs);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:20,代码来源:PartnerBrowserCustomizations.java

示例7: postTimeoutTask

import org.chromium.base.ThreadUtils; //导入方法依赖的package包/类
private void postTimeoutTask() {
    ThreadUtils.postOnUiThreadDelayed(new Runnable() {
        @Override
        public void run() {
            maybePostResult();
        }
    }, TIMEOUT_MS);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:9,代码来源:FeedbackCollector.java


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