Commit 29abbf88 authored by Troy Hildebrandt's avatar Troy Hildebrandt Committed by Commit Bot

Revert "Reland "Fix URL bar text being cropped by action buttons.""

This reverts commit 82d6a7b4.

Reason for revert: Working on a minor refactoring for phone/tablet
layouts to keep the logic separate until we can consolidate the two.

Original change's description:
> Reland "Fix URL bar text being cropped by action buttons."
>
> A recent change to the layout of the URL bar and the action buttons
> container broke the calculation and application of margin to the URL bar
> to avoid overlap between the action buttons and the URL bar.
>
> This CL fixes the calculation of the new action container's width and
> the appropriate margin to apply to the URL bar, fixing the issue where
> text in the URL bar was hidden underneath the action container.
>
> Bug: 816432,816376
> Change-Id: Ia0c75bec98755610682505c72a145ca53adb2913
> Reviewed-on: https://chromium-review.googlesource.com/952371
> Reviewed-by: Maria Khomenko <mariakhomenko@chromium.org>
> Reviewed-by: Theresa <twellington@chromium.org>
> Commit-Queue: Troy Hildebrandt <thildebr@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#541606}

TBR=mariakhomenko@chromium.org,twellington@chromium.org,thildebr@chromium.org

Change-Id: Ic68d461b9bb7addf4802dfc7536e4709967e5d99
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 816432, 816376
Reviewed-on: https://chromium-review.googlesource.com/955883Reviewed-by: default avatarMaria Khomenko <mariakhomenko@chromium.org>
Commit-Queue: Maria Khomenko <mariakhomenko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541817}
parent cc724182
...@@ -47,7 +47,6 @@ import android.view.ViewStub; ...@@ -47,7 +47,6 @@ import android.view.ViewStub;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
...@@ -161,7 +160,6 @@ public class LocationBarLayout extends FrameLayout ...@@ -161,7 +160,6 @@ public class LocationBarLayout extends FrameLayout
protected TintedImageButton mDeleteButton; protected TintedImageButton mDeleteButton;
protected TintedImageButton mMicButton; protected TintedImageButton mMicButton;
protected UrlBar mUrlBar; protected UrlBar mUrlBar;
private LinearLayout mUrlActionContainer;
/** A handle to the bottom sheet for chrome home. */ /** A handle to the bottom sheet for chrome home. */
protected BottomSheet mBottomSheet; protected BottomSheet mBottomSheet;
...@@ -722,8 +720,6 @@ public class LocationBarLayout extends FrameLayout ...@@ -722,8 +720,6 @@ public class LocationBarLayout extends FrameLayout
mSuggestionListAdapter = new OmniboxResultsAdapter(getContext(), this, mSuggestionItems); mSuggestionListAdapter = new OmniboxResultsAdapter(getContext(), this, mSuggestionItems);
mMicButton = (TintedImageButton) findViewById(R.id.mic_button); mMicButton = (TintedImageButton) findViewById(R.id.mic_button);
mUrlActionContainer = (LinearLayout) findViewById(R.id.url_action_container);
} }
@Override @Override
...@@ -1546,21 +1542,22 @@ public class LocationBarLayout extends FrameLayout ...@@ -1546,21 +1542,22 @@ public class LocationBarLayout extends FrameLayout
} }
} }
assert urlContainerChildIndex != -1;
int urlContainerMarginEnd = 0;
// When Chrome Home is enabled, the URL actions container slides out of view during the // When Chrome Home is enabled, the URL actions container slides out of view during the
// URL defocus animation. Adding margin during this animation creates a hole. // URL defocus animation. Adding margin during this animation creates a hole.
boolean addMarginForActionsContainer = boolean addMarginForActionsContainer =
(mBottomSheet == null || !mUrlFocusChangeInProgress || mUrlHasFocus) mBottomSheet == null || !mUrlFocusChangeInProgress || mUrlHasFocus;
&& mUrlActionContainer != null && mUrlActionContainer.getVisibility() != GONE;
int urlContainerMarginEnd = 0;
if (addMarginForActionsContainer) { if (addMarginForActionsContainer) {
for (int i = 0; i < mUrlActionContainer.getChildCount(); i++) { for (int i = urlContainerChildIndex + 1; i < getChildCount(); i++) {
View button = mUrlActionContainer.getChildAt(i); View childView = getChildAt(i);
LinearLayout.LayoutParams buttonLayoutParams = if (childView.getVisibility() != GONE) {
(LinearLayout.LayoutParams) button.getLayoutParams(); LayoutParams childLayoutParams = (LayoutParams) childView.getLayoutParams();
if (button.getVisibility() != GONE) { urlContainerMarginEnd = Math.max(urlContainerMarginEnd,
urlContainerMarginEnd += buttonLayoutParams.width childLayoutParams.width
+ ApiCompatibilityUtils.getMarginStart(buttonLayoutParams) + ApiCompatibilityUtils.getMarginStart(childLayoutParams)
+ ApiCompatibilityUtils.getMarginEnd(buttonLayoutParams); + ApiCompatibilityUtils.getMarginEnd(childLayoutParams));
} }
} }
} }
......
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