Commit eee59d96 authored by dfalcantara's avatar dfalcantara Committed by Commit bot

Revert "🔍 Hide the Google G by default"

This reverts commit 1204d239.

This introduced one bug and exposed another.  Yay!

BUG=709884,709886
TBR=bauerb,peconn

Review-Url: https://codereview.chromium.org/2806373003
Cr-Commit-Position: refs/heads/master@{#463356}
parent e03e0c39
...@@ -5,11 +5,25 @@ ...@@ -5,11 +5,25 @@
<!-- The location bar also know as URL bar --> <!-- The location bar also know as URL bar -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<ViewStub <!-- The container for the Google G is kept at a fixed width to make the horizonal translation
android:id="@+id/google_g_container_stub" calculations work. The contents are end-aligned, so when the location bar expands,
the space in the start margin will be pushed out, creating the effect of both margins
shrinking simultaneously. -->
<FrameLayout android:id="@+id/google_g_container"
android:layout_width="@dimen/location_bar_google_g_container_width" android:layout_width="@dimen/location_bar_google_g_container_width"
android:layout_height="match_parent" android:layout_height="match_parent" >
android:layout="@layout/location_bar_google_g" />
<ImageView android:id="@+id/google_g"
style="@style/LocationBarButton"
android:layout_width="@dimen/location_bar_google_g_width"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/location_bar_google_g_margin"
android:layout_gravity="end"
android:scaleType="fitCenter"
android:src="@drawable/googleg"
android:contentDescription="@null" />
</FrameLayout>
<ImageView android:id="@+id/incognito_badge" <ImageView android:id="@+id/incognito_badge"
style="@style/LocationBarButton" style="@style/LocationBarButton"
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<!-- The container for the Google G is kept at a fixed width to make the horizontal translation
calculations work. The contents are end-aligned, so when the location bar expands,
the space in the start margin will be pushed out, creating the effect of both margins
shrinking simultaneously. -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/location_bar_google_g_container_width"
android:layout_height="match_parent" >
<ImageView android:id="@+id/google_g"
style="@style/LocationBarButton"
android:layout_width="@dimen/location_bar_google_g_width"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/location_bar_google_g_margin"
android:layout_gravity="end"
android:scaleType="fitCenter"
android:src="@drawable/googleg"
android:contentDescription="@null" />
</FrameLayout>
...@@ -13,7 +13,6 @@ import android.text.Selection; ...@@ -13,7 +13,6 @@ import android.text.Selection;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.TouchDelegate; import android.view.TouchDelegate;
import android.view.View; import android.view.View;
import android.view.ViewStub;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.Interpolator; import android.view.animation.Interpolator;
import android.widget.FrameLayout; import android.widget.FrameLayout;
...@@ -41,17 +40,16 @@ public class LocationBarPhone extends LocationBarLayout { ...@@ -41,17 +40,16 @@ public class LocationBarPhone extends LocationBarLayout {
private View mFirstVisibleFocusedView; private View mFirstVisibleFocusedView;
private View mIncognitoBadge; private View mIncognitoBadge;
private View mGoogleGContainer;
private View mGoogleG;
private View mUrlActionsContainer; private View mUrlActionsContainer;
private int mIncognitoBadgePadding; private int mIncognitoBadgePadding;
private int mGoogleGWidth;
private int mGoogleGMargin;
private float mUrlFocusChangePercent; private float mUrlFocusChangePercent;
private Runnable mKeyboardResizeModeTask; private Runnable mKeyboardResizeModeTask;
private ObjectAnimator mOmniboxBackgroundAnimator; private ObjectAnimator mOmniboxBackgroundAnimator;
private ViewStub mGoogleGContainer;
private View mGoogleG;
private int mGoogleGWidth;
private int mGoogleGMargin;
/** /**
* Constructor used to inflate from XML. * Constructor used to inflate from XML.
*/ */
...@@ -68,7 +66,8 @@ public class LocationBarPhone extends LocationBarLayout { ...@@ -68,7 +66,8 @@ public class LocationBarPhone extends LocationBarLayout {
mIncognitoBadgePadding = mIncognitoBadgePadding =
getResources().getDimensionPixelSize(R.dimen.location_bar_incognito_badge_padding); getResources().getDimensionPixelSize(R.dimen.location_bar_incognito_badge_padding);
mGoogleGContainer = (ViewStub) findViewById(R.id.google_g_container_stub); mGoogleGContainer = findViewById(R.id.google_g_container);
mGoogleG = findViewById(R.id.google_g);
mGoogleGWidth = getResources().getDimensionPixelSize(R.dimen.location_bar_google_g_width); mGoogleGWidth = getResources().getDimensionPixelSize(R.dimen.location_bar_google_g_width);
mGoogleGMargin = getResources().getDimensionPixelSize(R.dimen.location_bar_google_g_margin); mGoogleGMargin = getResources().getDimensionPixelSize(R.dimen.location_bar_google_g_margin);
...@@ -237,15 +236,11 @@ public class LocationBarPhone extends LocationBarLayout { ...@@ -237,15 +236,11 @@ public class LocationBarPhone extends LocationBarLayout {
// If the default search engine is not Google, isLocationBarShownInNTP() will return false. // If the default search engine is not Google, isLocationBarShownInNTP() will return false.
if (ntp == null || !ntp.isLocationBarShownInNTP() if (ntp == null || !ntp.isLocationBarShownInNTP()
|| !ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_SHOW_GOOGLE_G_IN_OMNIBOX)) { || !ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_SHOW_GOOGLE_G_IN_OMNIBOX)) {
mGoogleGContainer.setVisibility(View.GONE);
return; return;
} }
// Inflate the resource if it hasn't been done yet. mGoogleGContainer.setVisibility(View.VISIBLE);
if (mGoogleG == null) {
mGoogleGContainer.inflate();
mGoogleG = findViewById(R.id.google_g);
}
float animationProgress = float animationProgress =
GOOGLE_G_FADE_INTERPOLATOR.getInterpolation(mUrlFocusChangePercent); GOOGLE_G_FADE_INTERPOLATOR.getInterpolation(mUrlFocusChangePercent);
......
...@@ -6,7 +6,9 @@ package org.chromium.chrome.browser.searchwidget; ...@@ -6,7 +6,9 @@ package org.chromium.chrome.browser.searchwidget;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.omnibox.LocationBarLayout; import org.chromium.chrome.browser.omnibox.LocationBarLayout;
/** Implementation of the {@link LocationBarLayout} that is displayed for widget searches. */ /** Implementation of the {@link LocationBarLayout} that is displayed for widget searches. */
...@@ -24,6 +26,8 @@ public class SearchActivityLocationBarLayout extends LocationBarLayout { ...@@ -24,6 +26,8 @@ public class SearchActivityLocationBarLayout extends LocationBarLayout {
public SearchActivityLocationBarLayout(Context context, AttributeSet attrs) { public SearchActivityLocationBarLayout(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
View gContainer = findViewById(R.id.google_g_container);
if (gContainer != null) gContainer.setVisibility(View.GONE);
} }
/** Set the {@link Delegate}. */ /** Set the {@link Delegate}. */
......
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