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

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: address comments 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 8b3701daa9c704cf1e7df58ddccff547e38a2bc2..ba8338109b648bf842d94a319596c003504d9ed4 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
@@ -234,8 +234,15 @@ public class BottomSheet extends LinearLayout {
root.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ // Make sure the size of the layout actually changed.
+ if (bottom - top == oldBottom - oldTop && right - left == oldRight - oldLeft) {
+ return;
+ }
+
mContainerHeight = bottom - top;
updateSheetPeekHeight();
+
+ cancelAnimation();
setSheetState(mCurrentState, false);
}
});
@@ -244,8 +251,15 @@ public class BottomSheet extends LinearLayout {
controlContainer.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ // Make sure the size of the layout actually changed.
+ if (bottom - top == oldBottom - oldTop && right - left == oldRight - oldLeft) {
+ return;
+ }
+
mToolbarHeight = bottom - top;
updateSheetPeekHeight();
+
+ cancelAnimation();
setSheetState(mCurrentState, false);
}
});
@@ -352,7 +366,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(@SheetState int state, boolean animate) {
+ public void setSheetState(@SheetState int state, boolean animate) {
mCurrentState = state;
if (animate) {
@@ -363,6 +377,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;
+ }
+
+ /**
* Gets 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