Java Code Examples for org.chromium.chrome.browser.util.ColorUtils#getDarkenedColorForStatusBar()

The following examples show how to use org.chromium.chrome.browser.util.ColorUtils#getDarkenedColorForStatusBar() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebappActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
private void updateTaskDescription() {
    String title = null;
    if (!TextUtils.isEmpty(mWebappInfo.shortName())) {
        title = mWebappInfo.shortName();
    } else if (getActivityTab() != null) {
        title = getActivityTab().getTitle();
    }

    Bitmap icon = null;
    if (mWebappInfo.icon() != null) {
        icon = mWebappInfo.icon();
    } else if (getActivityTab() != null) {
        icon = mLargestFavicon;
    }

    if (mBrandColor == null && mWebappInfo.hasValidThemeColor()) {
        mBrandColor = (int) mWebappInfo.themeColor();
    }

    int taskDescriptionColor =
            ApiCompatibilityUtils.getColor(getResources(), R.color.default_primary_color);
    int statusBarColor = Color.BLACK;
    if (mBrandColor != null) {
        taskDescriptionColor = mBrandColor;
        statusBarColor = ColorUtils.getDarkenedColorForStatusBar(mBrandColor);
    }

    ApiCompatibilityUtils.setTaskDescription(this, title, icon,
            ColorUtils.getOpaqueColor(taskDescriptionColor));
    ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}
 
Example 2
Source File: WebappActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void updateTaskDescription() {
    String title = null;
    if (!TextUtils.isEmpty(mWebappInfo.shortName())) {
        title = mWebappInfo.shortName();
    } else if (getActivityTab() != null) {
        title = getActivityTab().getTitle();
    }

    Bitmap icon = null;
    if (mWebappInfo.icon() != null) {
        icon = mWebappInfo.icon();
    } else if (getActivityTab() != null) {
        icon = mLargestFavicon;
    }

    if (mBrandColor == null && mWebappInfo.hasValidThemeColor()) {
        mBrandColor = (int) mWebappInfo.themeColor();
    }

    int taskDescriptionColor =
            ApiCompatibilityUtils.getColor(getResources(), R.color.default_primary_color);
    int statusBarColor = Color.BLACK;
    if (mBrandColor != null) {
        taskDescriptionColor = mBrandColor;
        statusBarColor = ColorUtils.getDarkenedColorForStatusBar(mBrandColor);
    }

    ApiCompatibilityUtils.setTaskDescription(this, title, icon,
            ColorUtils.getOpaqueColor(taskDescriptionColor));
    ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}
 
Example 3
Source File: WebappActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void updateTaskDescription() {
    String title = null;
    if (!TextUtils.isEmpty(mWebappInfo.shortName())) {
        title = mWebappInfo.shortName();
    } else if (getActivityTab() != null) {
        title = getActivityTab().getTitle();
    }

    Bitmap icon = null;
    if (mWebappInfo.icon() != null) {
        icon = mWebappInfo.icon();
    } else if (getActivityTab() != null) {
        icon = mLargestFavicon;
    }

    if (mBrandColor == null && mWebappInfo.hasValidThemeColor()) {
        mBrandColor = (int) mWebappInfo.themeColor();
    }

    int taskDescriptionColor =
            ApiCompatibilityUtils.getColor(getResources(), R.color.default_primary_color);

    // Don't use the brand color for the status bars if we're in display: fullscreen. This works
    // around an issue where the status bars go transparent and can't be seen on top of the page
    // content when users swipe them in or they appear because the on-screen keyboard was
    // triggered.
    int statusBarColor = Color.BLACK;
    if (mBrandColor != null && mWebappInfo.displayMode() != WebDisplayMode.FULLSCREEN) {
        taskDescriptionColor = mBrandColor;
        statusBarColor = ColorUtils.getDarkenedColorForStatusBar(mBrandColor);
    }

    ApiCompatibilityUtils.setTaskDescription(this, title, icon,
            ColorUtils.getOpaqueColor(taskDescriptionColor));
    ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}
 
Example 4
Source File: ChromeActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Set device status bar to a given color.
 * @param tab The tab that is currently showing.
 * @param color The color that the status bar should be set to.
 */
protected void setStatusBarColor(Tab tab, int color) {
    int statusBarColor = (tab != null && tab.isDefaultThemeColor())
            ? Color.BLACK : ColorUtils.getDarkenedColorForStatusBar(color);
    ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}
 
Example 5
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Set device status bar to a given color.
 * @param tab The tab that is currently showing.
 * @param color The color that the status bar should be set to.
 */
protected void setStatusBarColor(Tab tab, int color) {
    int statusBarColor = (tab != null && tab.isDefaultThemeColor())
            ? Color.BLACK : ColorUtils.getDarkenedColorForStatusBar(color);
    ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}
 
Example 6
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Set device status bar to a given color.
 * @param tab The tab that is currently showing.
 * @param color The color that the status bar should be set to.
 */
protected void setStatusBarColor(Tab tab, int color) {
    int statusBarColor = (tab != null && tab.isDefaultThemeColor())
            ? Color.BLACK : ColorUtils.getDarkenedColorForStatusBar(color);
    ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}