Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java |
| index c0f587d3ca93982e64e5024eae53fa34b5846d50..a5764b1b50155233ab3ef6d4410718829e1731a5 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java |
| @@ -182,6 +182,8 @@ public class ToolbarPhone extends ToolbarLayout |
| private ValueAnimator mBrandColorTransitionAnimation; |
| private boolean mBrandColorTransitionActive; |
| + private boolean mShowMenuBadge; |
| + |
| /** |
| * Used to specify the visual state of the toolbar. |
| */ |
| @@ -283,10 +285,10 @@ public class ToolbarPhone extends ToolbarLayout |
| setLayoutTransition(null); |
| - mMenuButton.setVisibility(shouldShowMenuButton() ? View.VISIBLE : View.GONE); |
| + mMenuButtonWrapper.setVisibility(shouldShowMenuButton() ? View.VISIBLE : View.GONE); |
| if (FeatureUtilities.isDocumentMode(getContext())) { |
| ApiCompatibilityUtils.setMarginEnd( |
| - (MarginLayoutParams) mMenuButton.getLayoutParams(), |
| + (MarginLayoutParams) mMenuButtonWrapper.getLayoutParams(), |
| getResources().getDimensionPixelSize(R.dimen.document_toolbar_menu_offset)); |
| } |
| @@ -978,6 +980,17 @@ public class ToolbarPhone extends ToolbarLayout |
| mTabSwitcherAnimationMenuDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN); |
| mTabSwitcherAnimationMenuDrawable.draw(canvas); |
| } |
| + if (mShowMenuBadge) { |
| + // TODO(twellington): adjust for mUrlExpansionPercent? In what scenarios will the code |
| + // below not draw in the correct position? |
| + int previousVisibility = mMenuBadge.getVisibility(); |
| + mMenuBadge.setVisibility(View.VISIBLE); |
| + int previousMenuBadgeAlpha = mMenuBadge.getImageAlpha(); |
| + mMenuBadge.setImageAlpha(rgbAlpha); |
| + drawChild(canvas, mMenuBadge, SystemClock.uptimeMillis()); |
| + mMenuBadge.setVisibility(previousVisibility); |
| + mMenuBadge.setImageAlpha(previousMenuBadgeAlpha); |
|
gone
2015/12/08 22:24:24
nit: rearrange for clarity?
int previousVisibilit
Theresa
2015/12/10 03:53:18
Done.
|
| + } |
| canvas.restore(); |
| } |
| @@ -1486,12 +1499,12 @@ public class ToolbarPhone extends ToolbarLayout |
| URL_FOCUS_TOOLBAR_BUTTONS_TRANSLATION_X_DP, isRtl) * density; |
| animator = ObjectAnimator.ofFloat( |
| - mMenuButton, TRANSLATION_X, toolbarButtonTranslationX); |
| + mMenuButtonWrapper, TRANSLATION_X, toolbarButtonTranslationX); |
| animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); |
| animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); |
| animators.add(animator); |
| - animator = ObjectAnimator.ofFloat(mMenuButton, ALPHA, 0); |
| + animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, ALPHA, 0); |
| animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); |
| animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); |
| animators.add(animator); |
| @@ -1516,13 +1529,13 @@ public class ToolbarPhone extends ToolbarLayout |
| animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); |
| animators.add(animator); |
| - animator = ObjectAnimator.ofFloat(mMenuButton, TRANSLATION_X, 0); |
| + animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, TRANSLATION_X, 0); |
| animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); |
| animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); |
| animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); |
| animators.add(animator); |
| - animator = ObjectAnimator.ofFloat(mMenuButton, ALPHA, 1); |
| + animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, ALPHA, 1); |
| animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); |
| animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); |
| animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); |
| @@ -1966,5 +1979,26 @@ public class ToolbarPhone extends ToolbarLayout |
| public LocationBar getLocationBar() { |
| return mPhoneLocationBar; |
| } |
| + |
| + @Override |
| + public void showAppMenuUpdateBadge() { |
| + mShowMenuBadge = true; |
| + if (!mBrowsingModeViews.contains(mMenuBadge)) { |
| + mBrowsingModeViews.add(mMenuBadge); |
| + } |
| + if (!mInTabSwitcherMode) { |
| + mMenuBadge.setVisibility(View.VISIBLE); |
| + } else { |
| + mMenuBadge.setVisibility(View.INVISIBLE); |
|
gone
2015/12/08 22:24:24
View.GONE?
Theresa
2015/12/10 03:53:18
Done.
|
| + } |
| + mPhoneLocationBar.showAppMenuBadge(); |
| + // TODO(twellington): Add a 1dp transparent border around the badge here and add logic |
| + // to show the original app menu button in overview mode. |
| + } |
| + |
| + @Override |
| + protected View getMenuButton() { |
|
gone
2015/12/08 22:24:24
getMenuButtonWrapper()? Will get confusing becaus
Theresa
2015/12/10 03:53:18
Done. Changed the logic in ToolbarLayout and delet
|
| + return mMenuButtonWrapper; |
| + } |
| } |