From c8a0d478257069157d6c4c321735019f7daf4d25 Mon Sep 17 00:00:00 2001 From: dsn5ft <1420597+dsn5ft@users.noreply.github.com> Date: Tue, 18 Apr 2023 08:33:25 -0700 Subject: [PATCH] [Bottom Sheet] Add method to allow programmatically changing shouldRemoveExpandedCorners behavior PiperOrigin-RevId: 525155162 --- .../bottomsheet/BottomSheetBehavior.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java b/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java index 4976c48a686..97e82f4ce69 100644 --- a/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java +++ b/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java @@ -1364,6 +1364,26 @@ public boolean isGestureInsetBottomIgnored() { return gestureInsetBottomIgnored; } + /** + * Sets whether the bottom sheet should remove its corners when it reaches the expanded state. + * + *
If false, the bottom sheet will only remove its corners if it is expanded and reaches the + * top of the screen. + */ + public void setShouldRemoveExpandedCorners(boolean shouldRemoveExpandedCorners) { + if (this.shouldRemoveExpandedCorners != shouldRemoveExpandedCorners) { + this.shouldRemoveExpandedCorners = shouldRemoveExpandedCorners; + updateDrawableForTargetState(getState(), /* animate= */ true); + } + } + + /** + * Returns whether the bottom sheet will remove its corners when it reaches the expanded state. + */ + public boolean isShouldRemoveExpandedCorners() { + return shouldRemoveExpandedCorners; + } + /** * Gets the current state of the bottom sheet. *