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

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

Issue 2751583002: 🏡 Show correct BottomSheetContent toolbar when contents swapped (Closed)
Patch Set: Remove duplicate "and" Created 3 years, 9 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
Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java
index 5c1b66594bfbf4ff0a25e9b0aedb8534c02ed7b6..e64d965050cfbe366959b6cb3524962b389fc3a3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java
@@ -10,6 +10,7 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
@@ -230,4 +231,28 @@ public class BottomToolbarPhone extends ToolbarPhone implements BottomSheetObser
getLocationBar().setUrlBarFocus(false);
}
}
+
+ /**
+ * Sets the height and title text appearance of the provided toolbar so that its style is
+ * consistent with BottomToolbarPhone.
+ * @param otherToolbar The other {@link Toolbar} to style.
+ */
+ public void setOtherToolbarStyle(Toolbar otherToolbar) {
+ // Android's Toolbar class typically changes its height based on device orientation.
+ // BottomToolbarPhone has a fixed height. Update |toolbar| to match.
+ otherToolbar.getLayoutParams().height = getHeight();
+
+ // Android Toolbar action buttons are aligned based on the minimum height.
+ int extraTopMargin = getExtraTopMargin();
+ otherToolbar.setMinimumHeight(getHeight() - extraTopMargin);
+
+ otherToolbar.setTitleTextAppearance(
+ otherToolbar.getContext(), R.style.BottomSheetContentTitle);
+ ApiCompatibilityUtils.setPaddingRelative(otherToolbar,
+ ApiCompatibilityUtils.getPaddingStart(otherToolbar),
+ otherToolbar.getPaddingTop() + extraTopMargin,
+ ApiCompatibilityUtils.getPaddingEnd(otherToolbar), otherToolbar.getPaddingBottom());
+
+ otherToolbar.requestLayout();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698