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

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

Issue 1589023003: [Contextual Search] Enable for fullscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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/OverlayPanelAnimation.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelAnimation.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelAnimation.java
index d7e4b7186e1f3410f45c2d443d090b68508e7018..237fbb2701c1b77adef22bdae1bdf1c60633aa83 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelAnimation.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelAnimation.java
@@ -83,6 +83,16 @@ public abstract class OverlayPanelAnimation extends OverlayPanelBase
*/
private boolean mIsAnimatingPanelClosing;
+ /**
+ * Whether the panel's expand animation is running.
+ */
+ private boolean mIsAnimatingPanelExpanding;
+
+ /**
+ * The reason for the panel expanding.
+ */
+ private StateChangeReason mPanelExpansionStateChangeReason;
+
// ============================================================================================
// Constructor
// ============================================================================================
@@ -121,6 +131,8 @@ public abstract class OverlayPanelAnimation extends OverlayPanelBase
* @param reason The reason for the change of panel state.
*/
protected void expandPanel(StateChangeReason reason) {
+ mIsAnimatingPanelExpanding = true;
+ mPanelExpansionStateChangeReason = reason;
animatePanelToState(PanelState.EXPANDED, reason);
}
@@ -164,6 +176,19 @@ public abstract class OverlayPanelAnimation extends OverlayPanelBase
}
}
+ @Override
+ public void onSizeChanged(float width, float height, boolean isToolbarShowing) {
+ super.onSizeChanged(width, height, isToolbarShowing);
+ // In fullscreen, when the panel is opened the bottom Android controls show causing
+ // a call to onSizeChanged(). Since the screen size changes, the height of the panel
+ // needs to be recalculated. If the expansion animation is running, cancel it and start
+ // a new one, so that the panel ends up in the right position.
+ if (mIsAnimatingPanelExpanding) {
+ cancelHeightAnimation();
+ expandPanel(mPanelExpansionStateChangeReason);
+ }
+ }
+
/**
* Animates the Overlay Panel to a given |state| with a default duration.
*
@@ -422,9 +447,8 @@ public abstract class OverlayPanelAnimation extends OverlayPanelBase
onPromoAcceptanceAnimationFinished();
}
- if (mIsAnimatingPanelClosing) {
- mIsAnimatingPanelClosing = false;
- }
+ mIsAnimatingPanelClosing = false;
+ mIsAnimatingPanelExpanding = false;
// If animating to a particular PanelState, and after completing
// resizing the Panel to its desired state, then the Panel's state

Powered by Google App Engine
This is Rietveld 408576698