Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java

Issue 2132043002: Set translation of toolbar buttons on Url Animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6b1cd17da9b07d795852f2017c32abedcb2b4c94..97bc747662578f0fa54820adc62d9ba10e1d8bb5 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
@@ -903,12 +903,7 @@ public class ToolbarPhone extends ToolbarLayout
(mNtpSearchBoxTransformedBounds.top - mPhoneLocationBar.getTop()
+ halfHeightDifference)));
if (!mUrlFocusChangeInProgress) {
- float searchBoxTranslationY =
- mNtpSearchBoxTransformedBounds.top - mNtpSearchBoxOriginalBounds.top;
- searchBoxTranslationY = Math.min(searchBoxTranslationY, 0);
- mToolbarButtonsContainer.setTranslationY(searchBoxTranslationY);
- mReturnButton.setTranslationY(searchBoxTranslationY);
- mHomeButton.setTranslationY(searchBoxTranslationY);
+ setButtonsTranslationY();
}
mLocationBarBackgroundOffset.set(
@@ -938,6 +933,15 @@ public class ToolbarPhone extends ToolbarLayout
mForceDrawLocationBarBackground = mUrlExpansionPercent != 0f;
}
+ private void setButtonsTranslationY() {
+ float searchBoxTranslationY =
+ mNtpSearchBoxTransformedBounds.top - mNtpSearchBoxOriginalBounds.top;
+ searchBoxTranslationY = Math.min(searchBoxTranslationY, 0);
+ mToolbarButtonsContainer.setTranslationY(searchBoxTranslationY);
+ mReturnButton.setTranslationY(searchBoxTranslationY);
+ mHomeButton.setTranslationY(searchBoxTranslationY);
+ }
+
private void setAncestorsShouldClipChildren(boolean clip) {
if (!isLocationBarShownInNTP()) return;
ViewGroup parent = this;
@@ -1719,10 +1723,10 @@ public class ToolbarPhone extends ToolbarLayout
// during the URL focus and defocus animations it should not be touched. Unfortunately
// updateNtpTransitionAnimation() is called a few times after the URL focus animation has
// been completed while mUrlFocusChangeInProgress is set to false, causing translationY to
- // non-zero at the end.
+ // incorrect at the end.
// We reset the translationY here so the mToolbarButtonsContainer is on screen for the
// defocusing animation.
- mToolbarButtonsContainer.setTranslationY(0f);
+ setButtonsTranslationY();
triggerUrlFocusAnimation(hasFocus);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698