Commit 85232302 authored by Lei Tian's avatar Lei Tian Committed by Commit Bot

Fix contextual search peeking pari is hidden behind CCT bottom bar

When CCT bottom bar is shown, the contextual search peeking bar is hidden
beneath it. The correct behavior should be when contextual search bar is
shown, CCT bottom bar should be dismissed.

To fix the problem, add a ContextualSearchObserver from the
CustomTabBottomBarDelegate to know when the contextual search bar is
shown/hidden, then hide/show bottom bar based on the observer's
callbacks.

BUG=684675

Change-Id: Iad53e7b8e83afcf127c7adcf1965cd4f75bc0afa
Reviewed-on: https://chromium-review.googlesource.com/693343Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Commit-Queue: Lei Tian <ltian@google.com>
Cr-Commit-Position: refs/heads/master@{#505887}
parent ba936162
...@@ -620,6 +620,7 @@ public class CustomTabActivity extends ChromeActivity { ...@@ -620,6 +620,7 @@ public class CustomTabActivity extends ChromeActivity {
public void initializeCompositor() { public void initializeCompositor() {
super.initializeCompositor(); super.initializeCompositor();
getTabModelSelector().onNativeLibraryReady(getTabContentManager()); getTabModelSelector().onNativeLibraryReady(getTabContentManager());
mBottomBarDelegate.addContextualSearchObserver();
} }
private void recordClientPackageName() { private void recordClientPackageName() {
......
...@@ -8,6 +8,7 @@ import android.app.PendingIntent; ...@@ -8,6 +8,7 @@ import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException; import android.app.PendingIntent.CanceledException;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent; import android.support.customtabs.CustomTabsIntent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
...@@ -22,8 +23,11 @@ import org.chromium.base.Log; ...@@ -22,8 +23,11 @@ import org.chromium.base.Log;
import org.chromium.base.metrics.CachedMetrics; import org.chromium.base.metrics.CachedMetrics;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager;
import org.chromium.chrome.browser.contextualsearch.ContextualSearchObserver;
import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager;
import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager.FullscreenListener; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager.FullscreenListener;
import org.chromium.chrome.browser.gsa.GSAContextDisplaySelection;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.ui.interpolators.BakedBezierInterpolator; import org.chromium.ui.interpolators.BakedBezierInterpolator;
...@@ -159,6 +163,34 @@ class CustomTabBottomBarDelegate implements FullscreenListener { ...@@ -159,6 +163,34 @@ class CustomTabBottomBarDelegate implements FullscreenListener {
return mBottomBarView; return mBottomBarView;
} }
public void addContextualSearchObserver() {
ContextualSearchManager manager = mActivity.getContextualSearchManager();
if (manager != null) {
ContextualSearchObserver observer = new ContextualSearchObserver() {
@Override
public void onShowContextualSearch(
@Nullable GSAContextDisplaySelection selectionContext) {
getBottomBarView()
.animate()
.alpha(0)
.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE)
.setDuration(SLIDE_ANIMATION_DURATION_MS)
.start();
}
@Override
public void onHideContextualSearch() {
getBottomBarView()
.animate()
.alpha(1)
.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE)
.setDuration(SLIDE_ANIMATION_DURATION_MS)
.start();
}
};
manager.addObserver(observer);
}
}
private void hideBottomBar() { private void hideBottomBar() {
if (mBottomBarView == null) return; if (mBottomBarView == null) return;
mBottomBarView.animate().alpha(0f).translationY(mBottomBarView.getHeight()) mBottomBarView.animate().alpha(0f).translationY(mBottomBarView.getHeight())
......
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