Commit b4c95876 authored by Theresa's avatar Theresa Committed by Commit Bot

[EoC] Fix tabswitcher overlay when EoC and incognito buttons shown

Fix the tabswitcher overlay when both the EoC and incognito toolbar
buttons are shown. Previously, when the incognito toggle button was
shown in the toolbar button container the EoC button was incorrectly
offset in the tabswitcher animation overlay.

The two buttons are now contained in a single FrameLayout and the
tabswitcher animation overlay draw logic is adjusted to properly
translate to the experimental button.

BUG=863819

Change-Id: I4a60f6f15b516f2a7933c3cde4e7a4a23831b0f7
Reviewed-on: https://chromium-review.googlesource.com/1148585Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577599}
parent 32bb2f2c
......@@ -44,23 +44,27 @@
android:layout_width="4dp"
android:layout_height="match_parent" />
<ViewStub
android:id="@+id/experimental_button_stub"
android:inflatedId="@+id/experimental_toolbar_button"
android:layout="@layout/experimental_toolbar_button"
style="@style/ToolbarButton"
android:paddingStart="8dp"
android:layout_gravity="top"
android:visibility="gone" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top" >
<ViewStub
android:id="@+id/incognito_button_stub"
android:inflatedId="@+id/incognito_button"
android:layout="@layout/toolbar_phone_incognito_button"
style="@style/ToolbarButton"
android:layout_gravity="top"
android:contentDescription="@string/accessibility_tabstrip_btn_incognito_toggle_standard"
android:visibility="gone" />
<ViewStub
android:id="@+id/experimental_button_stub"
android:inflatedId="@+id/experimental_toolbar_button"
android:layout="@layout/experimental_toolbar_button"
style="@style/ToolbarButton"
android:paddingStart="8dp"
android:visibility="gone" />
<ViewStub
android:id="@+id/incognito_button_stub"
android:inflatedId="@+id/incognito_button"
android:layout="@layout/toolbar_phone_incognito_button"
style="@style/ToolbarButton"
android:contentDescription="@string/accessibility_tabstrip_btn_incognito_toggle_standard"
android:visibility="gone" />
</FrameLayout>
<ImageButton android:id="@+id/tab_switcher_button"
style="@style/ToolbarButton"
......
......@@ -868,8 +868,12 @@ public class ToolbarPhone extends ToolbarLayout
// We set the incognito toggle button's visibility from GONE to VISIBLE when the tab
// switcher starts to open, but we don't want this to affect the Omnibox's size during the
// animation, so we have to make an adjustment here.
// However, if the experimental button is showing it sits in a FrameLayout with the
// incognito button and the omnibox will be appropriately sized without an explicit
// adjustment.
int incognitoButtonWidth = 0;
if (mIncognitoToggleButton != null && mIncognitoToggleButton.getVisibility() == VISIBLE) {
if (mIncognitoToggleButton != null && mIncognitoToggleButton.getVisibility() == VISIBLE
&& (mExperimentalButton == null || mExperimentalButton.getVisibility() == GONE)) {
incognitoButtonWidth += mIncognitoToggleButton.getMeasuredWidth();
}
return Math.max(mToolbarSidePadding,
......@@ -1392,10 +1396,15 @@ public class ToolbarPhone extends ToolbarLayout
// Draw the experimental button if necessary.
if (mExperimentalButton != null && mExperimentalButton.getVisibility() != View.GONE) {
canvas.save();
translateCanvasToView(mToolbarButtonsContainer, mExperimentalButton, canvas);
previousAlpha = mExperimentalButton.getAlpha();
mExperimentalButton.setAlpha(previousAlpha * floatAlpha);
drawChild(canvas, mExperimentalButton, SystemClock.uptimeMillis());
mExperimentalButton.setAlpha(previousAlpha);
canvas.restore();
}
// Draw the tab stack button and associated text.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment