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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java

Issue 2630513003: Expand bottom sheet when URL bar is focused (Closed)
Patch Set: ffs Created 3 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java ('k') | 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/widget/BottomSheet.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
index 83dbfd4c07a7a341742f61cddb230a028b3c5bcc..fe103bda1b8018e6f417a1dbee1e3acf112049c5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
@@ -222,7 +222,9 @@ public class BottomSheet extends LinearLayout {
int oldLeft, int oldTop, int oldRight, int oldBottom) {
mContainerHeight = bottom - top;
updateSheetPeekHeight(mToolbarHeight, mContainerHeight);
- setSheetState(mCurrentState, false);
+
+ // If animating, don't reset the sheet position.
+ if (!isRunningSettleAnimation()) setSheetState(mCurrentState, false);
Ian Wen 2017/01/17 19:23:59 I think you could cancel the current animation, an
mdjones 2017/01/17 21:59:31 This was for when the keyboard shows, onLayoutChan
}
});
@@ -232,7 +234,9 @@ public class BottomSheet extends LinearLayout {
int oldLeft, int oldTop, int oldRight, int oldBottom) {
mToolbarHeight = bottom - top;
updateSheetPeekHeight(mToolbarHeight, mContainerHeight);
- setSheetState(mCurrentState, false);
+
+ // If animating, don't reset the sheet position.
+ if (!isRunningSettleAnimation()) setSheetState(mCurrentState, false);
}
});
}
@@ -340,7 +344,7 @@ public class BottomSheet extends LinearLayout {
* @param animate If true, the sheet will animate to the provided state, otherwise it will
* move there instantly.
*/
- private void setSheetState(int state, boolean animate) {
+ public void setSheetState(int state, boolean animate) {
mCurrentState = state;
if (animate) {
@@ -351,6 +355,22 @@ public class BottomSheet extends LinearLayout {
}
/**
+ * @return The current state of the bottom sheet. If the sheet is animating, this will be the
+ * state the sheet is animating to.
+ */
+ public int getSheetState() {
+ return mCurrentState;
+ }
+
+ /**
+ * If the animation to settle the sheet in one of its states is running.
+ * @return True if the animation is running.
+ */
+ private boolean isRunningSettleAnimation() {
+ return mSettleAnimator != null;
+ }
+
+ /**
* Get the height of the bottom sheet based on a provided state.
* @param state The state to get the height from.
* @return The height of the sheet at the provided state.
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698