Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1600)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java

Issue 2781563002: Skip expanded state for Contextual Search when swiping down (Closed)
Patch Set: nits Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
index 71e715a22983e762bead98206d1f017d9adfa8df..f5dbe773f69c016f21ccb3f641802458f7c6ca2c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
@@ -51,6 +51,11 @@ public class ContextualSearchPanel extends OverlayPanel {
private final float mBarShadowHeightPx;
/**
+ * The distance of the divider from the end of the bar, in dp.
+ */
+ private final float mEndButtonWidthDp;
+
+ /**
* Whether the Panel should be promoted to a new tab after being maximized.
*/
private boolean mShouldPromoteToTabAfterMaximizing;
@@ -71,9 +76,9 @@ public class ContextualSearchPanel extends OverlayPanel {
private ContextualSearchSceneLayer mSceneLayer;
/**
- * The distance of the divider from the end of the bar, in dp.
+ * The velocity of the swipe gesture being handled.
*/
- private final float mEndButtonWidthDp;
+ private float mCurrentSwipeVelocity;
// ============================================================================================
// Constructor
@@ -221,10 +226,19 @@ public class ContextualSearchPanel extends OverlayPanel {
@Override
protected boolean isSupportedState(PanelState state) {
+ if (mCurrentSwipeVelocity > 0 && state == PanelState.EXPANDED) return false;
+
return canDisplayContentInPanel() || state != PanelState.MAXIMIZED;
}
@Override
+ protected float getThresholdToNextState() {
+ if (mCurrentSwipeVelocity > 0) return 0.30f;
+
+ return super.getThresholdToNextState();
+ }
+
+ @Override
protected float getExpandedHeight() {
if (canDisplayContentInPanel()) {
return super.getExpandedHeight();
@@ -235,6 +249,7 @@ public class ContextualSearchPanel extends OverlayPanel {
@Override
protected PanelState getProjectedState(float velocity) {
+ mCurrentSwipeVelocity = velocity;
PanelState projectedState = super.getProjectedState(velocity);
// Prevent the fling gesture from moving the Panel from PEEKED to MAXIMIZED. This is to
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698