Java Code Examples for org.chromium.chrome.browser.util.ColorUtils#isUsingDefaultToolbarColor()
The following examples show how to use
org.chromium.chrome.browser.util.ColorUtils#isUsingDefaultToolbarColor() .
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: CustomTabToolbar.java From delion with Apache License 2.0 | 6 votes |
@Override public void updateVisualsForState() { Resources resources = getResources(); updateSecurityIcon(getSecurityLevel()); updateButtonsTint(); mUrlBar.setUseDarkTextColors(mUseDarkColors); int titleTextColor = mUseDarkColors ? ApiCompatibilityUtils.getColor(resources, R.color.url_emphasis_default_text) : ApiCompatibilityUtils.getColor(resources, R.color.url_emphasis_light_default_text); mTitleBar.setTextColor(titleTextColor); if (getProgressBar() != null) { if (!ColorUtils.isUsingDefaultToolbarColor(getResources(), getBackground().getColor())) { getProgressBar().setThemeColor(getBackground().getColor(), false); } else { getProgressBar().setBackgroundColor(ApiCompatibilityUtils.getColor(resources, R.color.progress_bar_background)); getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(resources, R.color.progress_bar_foreground)); } } }
Example 2
Source File: CustomTabToolbar.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public void updateVisualsForState() { Resources resources = getResources(); updateSecurityIcon(getSecurityLevel()); updateButtonsTint(); mUrlBar.setUseDarkTextColors(mUseDarkColors); int titleTextColor = mUseDarkColors ? ApiCompatibilityUtils.getColor(resources, R.color.url_emphasis_default_text) : ApiCompatibilityUtils.getColor(resources, R.color.url_emphasis_light_default_text); mTitleBar.setTextColor(titleTextColor); if (getProgressBar() != null) { if (!ColorUtils.isUsingDefaultToolbarColor(getResources(), getBackground().getColor())) { getProgressBar().setThemeColor(getBackground().getColor(), false); } else { getProgressBar().setBackgroundColor(ApiCompatibilityUtils.getColor(resources, R.color.progress_bar_background)); getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(resources, R.color.progress_bar_foreground)); } } }
Example 3
Source File: ToolbarProgressBar.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Color the progress bar based on the toolbar theme color. * @param color The Android color the toolbar is using. */ public void setThemeColor(int color, boolean isIncognito) { mThemeColor = color; // The default toolbar has specific colors to use. if ((ColorUtils.isUsingDefaultToolbarColor(getResources(), color) || !ColorUtils.isValidThemeColor(color)) && !isIncognito) { setForegroundColor(ApiCompatibilityUtils.getColor(getResources(), R.color.progress_bar_foreground)); setBackgroundColor(ApiCompatibilityUtils.getColor(getResources(), R.color.progress_bar_background)); return; } setForegroundColor(ColorUtils.getThemedAssetColor(color, isIncognito)); if (mAnimatingView != null && (ColorUtils.shouldUseLightForegroundOnBackground(color) || isIncognito)) { mAnimatingView.setColor(ColorUtils.getColorWithOverlay(color, Color.WHITE, ANIMATION_WHITE_FRACTION)); } setBackgroundColor(ColorUtils.getColorWithOverlay(color, Color.WHITE, THEMED_BACKGROUND_WHITE_FRACTION)); }
Example 4
Source File: CustomTabToolbar.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void updateVisualsForState() { Resources resources = getResources(); updateSecurityIcon(getSecurityLevel()); updateButtonsTint(); mUrlBar.setUseDarkTextColors(mUseDarkColors); int titleTextColor = mUseDarkColors ? ApiCompatibilityUtils.getColor(resources, R.color.url_emphasis_default_text) : ApiCompatibilityUtils.getColor(resources, R.color.url_emphasis_light_default_text); mTitleBar.setTextColor(titleTextColor); if (getProgressBar() != null) { if (!ColorUtils.isUsingDefaultToolbarColor(getResources(), getBackground().getColor())) { getProgressBar().setThemeColor(getBackground().getColor(), false); } else { getProgressBar().setBackgroundColor(ApiCompatibilityUtils.getColor(resources, R.color.progress_bar_background)); getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(resources, R.color.progress_bar_foreground)); } } }
Example 5
Source File: ToolbarProgressBar.java From delion with Apache License 2.0 | 5 votes |
/** * Color the progress bar based on the toolbar theme color. * @param color The Android color the toolbar is using. */ public void setThemeColor(int color, boolean isIncognito) { mThemeColor = color; // The default toolbar has specific colors to use. if (ColorUtils.isUsingDefaultToolbarColor(getResources(), color) && !isIncognito) { setForegroundColor(ApiCompatibilityUtils.getColor(getResources(), R.color.progress_bar_foreground)); setBackgroundColor(ApiCompatibilityUtils.getColor(getResources(), R.color.progress_bar_background)); return; } // All other theme colors are computed. if (!ColorUtils.shouldUseLightForegroundOnBackground(color) && !isIncognito) { // Light theme. setForegroundColor(ColorUtils.getColorWithOverlay(color, Color.BLACK, THEMED_FOREGROUND_BLACK_FRACTION)); } else { // Dark theme. setForegroundColor(Color.WHITE); if (mAnimatingView != null) { mAnimatingView.setColor(ColorUtils.getColorWithOverlay(color, Color.WHITE, ANIMATION_WHITE_FRACTION)); } } setBackgroundColor(ColorUtils.getColorWithOverlay(color, Color.WHITE, THEMED_BACKGROUND_WHITE_FRACTION)); }
Example 6
Source File: ToolbarProgressBar.java From 365browser with Apache License 2.0 | 5 votes |
/** * Color the progress bar based on the toolbar theme color. * @param color The Android color the toolbar is using. */ public void setThemeColor(int color, boolean isIncognito) { mThemeColor = color; boolean isDefaultTheme = ColorUtils.isUsingDefaultToolbarColor(getResources(), color); // All colors use a single path if using the status bar color as the background. if (mUseStatusBarColorAsBackground) { if (isDefaultTheme) color = Color.BLACK; setForegroundColor( ApiCompatibilityUtils.getColor(getResources(), R.color.white_alpha_70)); setBackgroundColor(ColorUtils.getDarkenedColorForStatusBar(color)); return; } // The default toolbar has specific colors to use. if ((isDefaultTheme || !ColorUtils.isValidThemeColor(color)) && !isIncognito) { setForegroundColor(ApiCompatibilityUtils.getColor(getResources(), R.color.progress_bar_foreground)); setBackgroundColor(ApiCompatibilityUtils.getColor(getResources(), R.color.progress_bar_background)); return; } setForegroundColor(ColorUtils.getThemedAssetColor(color, isIncognito)); if (mAnimatingView != null && (ColorUtils.shouldUseLightForegroundOnBackground(color) || isIncognito)) { mAnimatingView.setColor(ColorUtils.getColorWithOverlay(color, Color.WHITE, ANIMATION_WHITE_FRACTION)); } setBackgroundColor(ColorUtils.getColorWithOverlay(color, Color.WHITE, THEMED_BACKGROUND_WHITE_FRACTION)); }