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

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

Issue 1379183003: [ContextualSearch] Adds long press promo for Contextual Search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing David's comments and tweaking policy Created 5 years, 2 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
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
index 3af21450a9a96a806af3dfc66ede06d07a96623d..3bb40df32a2ef399c290e2b02920593c8615899f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
@@ -547,7 +547,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
private float mSearchBarMarginSide;
private float mSearchBarHeight;
private boolean mIsSearchBarBorderVisible;
- private float mSearchBarBorderY;
private float mSearchBarBorderHeight;
private boolean mSearchBarShadowVisible = false;
@@ -580,13 +579,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
- * @return The Y coordinate of the Search Bar border.
- */
- public float getSearchBarBorderY() {
- return mSearchBarBorderY;
- }
-
- /**
* @return The height of the Search Bar border.
*/
public float getSearchBarBorderHeight() {
@@ -685,7 +677,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
private float mProgressBarOpacity;
private boolean mIsProgressBarVisible;
- private float mProgressBarY;
private float mProgressBarHeight;
private int mProgressBarCompletion;
@@ -704,13 +695,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
- * @return The Y coordinate of the Progress Bar.
- */
- public float getProgressBarY() {
- return mProgressBarY;
- }
-
- /**
* @return The Progress Bar height.
*/
public float getProgressBarHeight() {
@@ -1054,7 +1038,13 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
private float getStateCompletion(float height, PanelState startState, PanelState endState) {
float startSize = getPanelHeightFromState(startState);
float endSize = getPanelHeightFromState(endState);
- float percentage = (height - startSize) / (endSize - startSize);
+ float percentage =
+ // NOTE(pedrosimonetti): Handle special case from PanelState.UNDEFINED
+ // to PanelState.CLOSED, where both have a height of zero. Returning
+ // zero here means the Panel will be reset to its CLOSED state.
+ startSize == 0.f && endSize == 0.f ? 0.f :
+ (height - startSize) / (endSize - startSize);
+
return percentage;
}
@@ -1064,7 +1054,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
*
* @param percentage The completion percentage.
*/
- private void updatePanelForCloseOrPeek(float percentage) {
+ protected void updatePanelForCloseOrPeek(float percentage) {
// Update the opt out promo.
updatePromoVisibility(1.f);
@@ -1099,7 +1089,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
*
* @param percentage The completion percentage.
*/
- private void updatePanelForExpansion(float percentage) {
+ protected void updatePanelForExpansion(float percentage) {
// Update the opt out promo.
updatePromoVisibility(1.f);
@@ -1126,7 +1116,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
// Search Bar border.
mIsSearchBarBorderVisible = true;
- mSearchBarBorderY = searchBarHeight - SEARCH_BAR_BORDER_HEIGHT_DP + 1;
// Determine fading element opacities. The arrow icon needs to finish fading out before
// the close icon starts fading in. Any other elements fading in or fading out should use
@@ -1154,7 +1143,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
// screen.
float progressBarOpacity = MathUtils.interpolate(0.f, 1.f, diff / threshold);
mProgressBarOpacity = progressBarOpacity;
- mProgressBarY = searchBarHeight - PROGRESS_BAR_HEIGHT_DP + 1;
// Update the Search Bar Shadow.
updateSearchBarShadow();
@@ -1166,7 +1154,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
*
* @param percentage The completion percentage.
*/
- private void updatePanelForMaximization(float percentage) {
+ protected void updatePanelForMaximization(float percentage) {
// Update the opt out promo.
float promoVisibilityPercentage = isFullscreenSizePanel() ? 1.f - percentage : 1.f;
updatePromoVisibility(promoVisibilityPercentage);
@@ -1190,7 +1178,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
// Search Bar border.
mIsSearchBarBorderVisible = true;
- mSearchBarBorderY = searchBarHeight - SEARCH_BAR_BORDER_HEIGHT_DP + 1;
// Arrow Icon.
mArrowIconOpacity = ARROW_ICON_OPACITY_STATE_MAXIMIZED;
@@ -1200,7 +1187,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
// Progress Bar.
mProgressBarOpacity = 1.f;
- mProgressBarY = searchBarHeight - PROGRESS_BAR_HEIGHT_DP + 1;
// Update the Search Bar Shadow.
updateSearchBarShadow();

Powered by Google App Engine
This is Rietveld 408576698