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

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

Issue 1219133003: Contextual Search UI changes for custom tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use fadingInPercentage and fadingOutPercentage, get rid of PanelBase#isCloseIconVisible() Created 5 years, 5 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 | chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java » ('j') | 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 4e61575465170c28683030d305f82a61c8458d8e..dd27eb5a348b6694b942383d1dd42eaa7d3bef88 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
@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.compositor.bottombar.contextualsearch;
import android.content.Context;
import android.os.Handler;
-import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel.StateChangeReason;
import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost;
import org.chromium.chrome.browser.contextualsearch.ContextualSearchManagementDelegate;
@@ -48,7 +47,8 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
SWIPE,
FLING,
OPTIN,
- OPTOUT;
+ OPTOUT,
+ CLOSE_BUTTON;
}
/**
@@ -243,11 +243,13 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
} else if (isExpanded()) {
peekPanel(StateChangeReason.SEARCH_BAR_TAP);
} else if (isMaximized()) {
- // TODO(twellington): check if click happened inside close button,
- // using ContextualSearchPanelFeatures.isCloseButtonAvailable().
if (ContextualSearchPanelFeatures.isSearchTermRefiningAvailable()) {
mManagementDelegate.promoteToTab(true);
}
+ if (ContextualSearchPanelFeatures.isCloseButtonAvailable()
+ && isCoordinateInsideCloseButton(x, y)) {
+ closePanel(StateChangeReason.CLOSE_BUTTON, true);
+ }
}
}
}
@@ -289,6 +291,17 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
}
/**
+ * @param x The x coordinate in dp.
+ * @param y The y coordinate in dp.
+ * @return Whether the given |x| |y| coordinate is inside the close button.
+ */
+ private boolean isCoordinateInsideCloseButton(float x, float y) {
+ boolean isInY = y >= getCloseIconY() && y <= (getCloseIconY() + getCloseIconDimension());
+ boolean isInX = x >= getCloseIconX() && x <= (getCloseIconX() + getCloseIconDimension());
+ return isInY && isInX;
+ }
+
+ /**
* @return Whether the Panel is in its expanded state.
*/
protected boolean isExpanded() {
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698