Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java |
index 9855702654d7897a831d8746a036d830dd17354f..47f973feefcc2b55e409355232960f2fc7eb6f64 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java |
@@ -77,8 +77,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
private long mFirstDrawTimeMs; |
- protected final int mToolbarHeightWithoutShadow; |
- |
private boolean mFindInPageToolbarShowing; |
protected boolean mShowMenuBadge; |
@@ -90,8 +88,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
*/ |
public ToolbarLayout(Context context, AttributeSet attrs) { |
super(context, attrs); |
- mToolbarHeightWithoutShadow = getResources().getDimensionPixelOffset( |
- getToolbarHeightWithoutShadowResId()); |
mDarkModeTint = |
ApiCompatibilityUtils.getColorStateList(getResources(), R.color.dark_mode_tint); |
mLightModeTint = |
@@ -104,17 +100,24 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
* @return The top margin of the progress bar. |
*/ |
protected int getProgressBarTopMargin() { |
- return mToolbarHeightWithoutShadow |
+ return getHeight() |
- getResources().getDimensionPixelSize(R.dimen.toolbar_progress_bar_height); |
} |
@Override |
- protected void onFinishInflate() { |
- super.onFinishInflate(); |
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) { |
+ super.onLayout(changed, left, top, right, bottom); |
- mProgressBar = new ToolbarProgressBar(getContext(), getProgressBarTopMargin()); |
+ if (mProgressBar == null) { |
gone
2017/03/14 22:38:40
Does this really have to be here? onLayout seems
mdjones
2017/03/15 17:26:12
This is the result of a bad rebase. The latest pat
|
+ mProgressBar = new ToolbarProgressBar(getContext(), getProgressBarTopMargin()); |
+ if (isNativeLibraryReady()) mProgressBar.initializeAnimation(); |
+ addProgressBarToHierarchy(); |
+ } |
+ } |
- if (isNativeLibraryReady()) mProgressBar.initializeAnimation(); |
+ @Override |
+ protected void onFinishInflate() { |
+ super.onFinishInflate(); |
mMenuButton = (TintedImageButton) findViewById(R.id.menu_button); |
mMenuBadge = (ImageView) findViewById(R.id.menu_badge); |
@@ -169,13 +172,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
} |
/** |
- * @return The resource id to be used while getting the toolbar height with no shadow. |
- */ |
- protected int getToolbarHeightWithoutShadowResId() { |
- return R.dimen.toolbar_height_no_shadow; |
- } |
- |
- /** |
* Initialize the external dependencies required for view interaction. |
* @param toolbarDataProvider The provider for toolbar data. |
* @param tabController The controller that handles interactions with the tab. |
@@ -263,12 +259,6 @@ public abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
mProgressBar.setProgressBarContainer(controlContainer); |
} |
- @Override |
- protected void onAttachedToWindow() { |
- super.onAttachedToWindow(); |
- addProgressBarToHierarchy(); |
- } |
- |
/** |
* Shows the content description toast for items on the toolbar. |
* @param view The view to anchor the toast. |