| 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();
|
| + }
|
| }
|
|
|