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

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

Issue 1347023004: [Contextual Search] Add close button in maximized state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup rebase Created 5 years, 3 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 310d1eb2dd8afd8bbe9278353cfee3ade5f877a2..66b191f0f07bfd163baec676c736f28c80dc1426 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
@@ -63,6 +63,11 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
private static final long INTERCEPT_NAVIGATION_PROMOTION_ANIMATION_DURATION_MS = 40;
/**
+ * The extra dp added around the close button touch target.
+ */
+ private static final int CLOSE_BUTTON_TOUCH_SLOP_DP = 5;
+
+ /**
* The activity this panel is in.
*/
private ChromeActivity mActivity;
@@ -296,15 +301,11 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
maximizePanel(StateChangeReason.SEARCH_BAR_TAP);
}
}
- } else if (isExpanded()) {
- peekPanel(StateChangeReason.SEARCH_BAR_TAP);
- } else if (isMaximized()) {
- if (mSearchPanelFeatures.isSearchTermRefiningAvailable()) {
- getManagementDelegate().promoteToTab();
- }
- if (mSearchPanelFeatures.isCloseButtonAvailable()
- && isCoordinateInsideCloseButton(x, y)) {
+ } else if (isExpanded() || isMaximized()) {
+ if (isCoordinateInsideCloseButton(x, y)) {
closePanel(StateChangeReason.CLOSE_BUTTON, true);
+ } else if (mSearchPanelFeatures.isSearchTermRefiningAvailable()) {
+ getManagementDelegate().promoteToTab();
}
}
}
@@ -373,8 +374,10 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
* @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());
+ boolean isInY = y >= (getCloseIconY() - CLOSE_BUTTON_TOUCH_SLOP_DP)
+ && y <= (getCloseIconY() + getCloseIconDimension() + CLOSE_BUTTON_TOUCH_SLOP_DP);
+ boolean isInX = x >= (getCloseIconX() - CLOSE_BUTTON_TOUCH_SLOP_DP)
+ && x <= (getCloseIconX() + getCloseIconDimension() + CLOSE_BUTTON_TOUCH_SLOP_DP);
return isInY && isInX;
}
« 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