File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
lib/java/com/google/android/material/bottomsheet Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,8 @@ void onLayout(@NonNull View bottomSheet) {}
292292
293293 private boolean nestedScrolled ;
294294
295+ private float hideFriction = HIDE_FRICTION ;
296+
295297 private int childHeight ;
296298 int parentWidth ;
297299 int parentHeight ;
@@ -1144,6 +1146,28 @@ public int getSaveFlags() {
11441146 return this .saveFlags ;
11451147 }
11461148
1149+ /**
1150+ * Sets the friction coefficient to hide the bottom sheet, or set it to the next closest
1151+ * expanded state.
1152+ *
1153+ * @param hideFriction The friction coefficient that determines the swipe velocity needed to
1154+ * hide or set the bottom sheet to the closest expanded state.
1155+ */
1156+ public void setHideFriction (float hideFriction ) {
1157+ this .hideFriction = hideFriction ;
1158+ }
1159+
1160+ /**
1161+ * Gets the friction coefficient to hide the bottom sheet, or set it to the next closest
1162+ * expanded state.
1163+ *
1164+ * @return The friction coefficient that determines the swipe velocity needed to hide or set the
1165+ * bottom sheet to the closest expanded state.
1166+ */
1167+ public float getHideFriction () {
1168+ return this .hideFriction ;
1169+ }
1170+
11471171 /**
11481172 * Sets a callback to be notified of bottom sheet events.
11491173 *
@@ -1393,7 +1417,7 @@ boolean shouldHide(@NonNull View child, float yvel) {
13931417 return false ;
13941418 }
13951419 int peek = calculatePeekHeight ();
1396- final float newTop = child .getTop () + yvel * HIDE_FRICTION ;
1420+ final float newTop = child .getTop () + yvel * hideFriction ;
13971421 return Math .abs (newTop - collapsedOffset ) / (float ) peek > HIDE_THRESHOLD ;
13981422 }
13991423
You can’t perform that action at this time.
0 commit comments