OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.toolbar; | 5 package org.chromium.chrome.browser.toolbar; |
6 | 6 |
7 import android.animation.Animator; | 7 import android.animation.Animator; |
8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
9 import android.animation.AnimatorSet; | 9 import android.animation.AnimatorSet; |
10 import android.animation.ObjectAnimator; | 10 import android.animation.ObjectAnimator; |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 | 913 |
914 // Draw the menu button if necessary. | 914 // Draw the menu button if necessary. |
915 if (mTabSwitcherAnimationMenuDrawable != null | 915 if (mTabSwitcherAnimationMenuDrawable != null |
916 && mUrlExpansionPercent != 1f) { | 916 && mUrlExpansionPercent != 1f) { |
917 mTabSwitcherAnimationMenuDrawable.setBounds( | 917 mTabSwitcherAnimationMenuDrawable.setBounds( |
918 mMenuButton.getPaddingLeft(), mMenuButton.getPaddingTop(), | 918 mMenuButton.getPaddingLeft(), mMenuButton.getPaddingTop(), |
919 mMenuButton.getWidth() - mMenuButton.getPaddingRight(), | 919 mMenuButton.getWidth() - mMenuButton.getPaddingRight(), |
920 mMenuButton.getHeight() - mMenuButton.getPaddingBottom()); | 920 mMenuButton.getHeight() - mMenuButton.getPaddingBottom()); |
921 translateCanvasToView(mToolbarButtonsContainer, mMenuButton, canvas)
; | 921 translateCanvasToView(mToolbarButtonsContainer, mMenuButton, canvas)
; |
922 mTabSwitcherAnimationMenuDrawable.setAlpha(rgbAlpha); | 922 mTabSwitcherAnimationMenuDrawable.setAlpha(rgbAlpha); |
| 923 int color = mUseLightToolbarDrawables ? getResources().getColor(R.co
lor.light_mode_tint) |
| 924 : getResources().getColor(R.color.dark_mode_tint); |
| 925 mTabSwitcherAnimationMenuDrawable.setColorFilter(color, PorterDuff.M
ode.SRC_IN); |
923 mTabSwitcherAnimationMenuDrawable.draw(canvas); | 926 mTabSwitcherAnimationMenuDrawable.draw(canvas); |
924 } | 927 } |
925 | 928 |
926 canvas.restore(); | 929 canvas.restore(); |
927 } | 930 } |
928 | 931 |
929 @Override | 932 @Override |
930 public void doInvalidate() { | 933 public void doInvalidate() { |
931 postInvalidateOnAnimation(); | 934 postInvalidateOnAnimation(); |
932 } | 935 } |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 mUnfocusedLocationBarUsesTransparentBg = | 1834 mUnfocusedLocationBarUsesTransparentBg = |
1832 !BrandColorUtils.shouldUseOpaqueTextboxBackground(currentPri
maryColor); | 1835 !BrandColorUtils.shouldUseOpaqueTextboxBackground(currentPri
maryColor); |
1833 mUrlBackgroundAlpha = mUnfocusedLocationBarUsesTransparentBg | 1836 mUrlBackgroundAlpha = mUnfocusedLocationBarUsesTransparentBg |
1834 ? LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA : 255; | 1837 ? LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA : 255; |
1835 progressBarBackgroundColorResource = mUseLightToolbarDrawables | 1838 progressBarBackgroundColorResource = mUseLightToolbarDrawables |
1836 ? R.color.progress_bar_background_white : R.color.progress_b
ar_background; | 1839 ? R.color.progress_bar_background_white : R.color.progress_b
ar_background; |
1837 } | 1840 } |
1838 | 1841 |
1839 getProgressBar().setBackgroundColor( | 1842 getProgressBar().setBackgroundColor( |
1840 getResources().getColor(progressBarBackgroundColorResource)); | 1843 getResources().getColor(progressBarBackgroundColorResource)); |
| 1844 ColorStateList dark = getResources().getColorStateList(R.color.dark_mode
_tint); |
| 1845 ColorStateList white = getResources().getColorStateList(R.color.light_mo
de_tint); |
1841 | 1846 |
1842 if (mToggleTabStackButton != null) { | 1847 if (mToggleTabStackButton != null) { |
1843 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables | 1848 mToggleTabStackButton.setImageDrawable(mUseLightToolbarDrawables |
1844 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab
le); | 1849 ? mTabSwitcherButtonDrawableLight : mTabSwitcherButtonDrawab
le); |
| 1850 mTabSwitcherAnimationTabStackDrawable.setTint(mUseLightToolbarDrawab
les ? white : dark); |
1845 } | 1851 } |
1846 | 1852 |
1847 ColorStateList dark = getResources().getColorStateList(R.color.dark_mode
_tint); | |
1848 ColorStateList white = getResources().getColorStateList(R.color.light_mo
de_tint); | |
1849 if (shouldShowMenuButton()) { | 1853 if (shouldShowMenuButton()) { |
1850 mMenuButton.setTint(mUseLightToolbarDrawables ? white : dark); | 1854 mMenuButton.setTint(mUseLightToolbarDrawables ? white : dark); |
1851 } | 1855 } |
1852 if (mHomeButton.getVisibility() != GONE) { | 1856 if (mHomeButton.getVisibility() != GONE) { |
1853 mHomeButton.setTint(mUseLightToolbarDrawables ? white : dark); | 1857 mHomeButton.setTint(mUseLightToolbarDrawables ? white : dark); |
1854 } | 1858 } |
1855 | 1859 |
1856 mPhoneLocationBar.updateVisualsForState(); | 1860 mPhoneLocationBar.updateVisualsForState(); |
1857 | 1861 |
1858 // We update the alpha before comparing the visual state as we need to c
hange | 1862 // We update the alpha before comparing the visual state as we need to c
hange |
(...skipping 15 matching lines...) Expand all Loading... |
1874 | 1878 |
1875 getMenuButton().setVisibility(shouldShowMenuButton() ? View.VISIBLE : Vi
ew.GONE); | 1879 getMenuButton().setVisibility(shouldShowMenuButton() ? View.VISIBLE : Vi
ew.GONE); |
1876 } | 1880 } |
1877 | 1881 |
1878 @Override | 1882 @Override |
1879 public LocationBar getLocationBar() { | 1883 public LocationBar getLocationBar() { |
1880 return mPhoneLocationBar; | 1884 return mPhoneLocationBar; |
1881 } | 1885 } |
1882 } | 1886 } |
1883 | 1887 |
OLD | NEW |