From 2fd2d66b4302d03929ede387ca83fef197940a67 Mon Sep 17 00:00:00 2001 From: afohrman Date: Thu, 15 Dec 2022 21:47:47 +0000 Subject: [PATCH] [Adaptive][Side Sheet] Fixed issue where sheet would jump to the far edge of the screen in RTL without temporary fix. PiperOrigin-RevId: 495687169 --- .../sidesheet/res/layout/cat_sidesheet_fragment.xml | 3 --- .../android/material/sidesheet/SideSheetBehavior.java | 7 +------ .../material/sidesheet/res/layout/m3_side_sheet_dialog.xml | 1 - .../android/material/sidesheet/res/values/styles.xml | 2 +- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/catalog/java/io/material/catalog/sidesheet/res/layout/cat_sidesheet_fragment.xml b/catalog/java/io/material/catalog/sidesheet/res/layout/cat_sidesheet_fragment.xml index c9d6e62e462..a63b85aef14 100644 --- a/catalog/java/io/material/catalog/sidesheet/res/layout/cat_sidesheet_fragment.xml +++ b/catalog/java/io/material/catalog/sidesheet/res/layout/cat_sidesheet_fragment.xml @@ -83,7 +83,6 @@ style="@style/Widget.Material3.SideSheet" android:layout_width="256dp" android:layout_height="match_parent" - android:layout_gravity="end" android:orientation="vertical" app:layout_behavior="@string/side_sheet_behavior" tools:targetApi="lollipop"> @@ -95,7 +94,6 @@ style="@style/Widget.Material3.SideSheet" android:layout_width="256dp" android:layout_height="match_parent" - android:layout_gravity="end" android:orientation="vertical" app:layout_behavior="@string/side_sheet_behavior" tools:targetApi="lollipop"> @@ -107,7 +105,6 @@ style="@style/Widget.Material3.SideSheet" android:layout_width="256dp" android:layout_height="match_parent" - android:layout_gravity="end" android:orientation="vertical" app:coplanarSiblingViewId="@id/nested_scroll_view" app:layout_behavior="@string/side_sheet_behavior" diff --git a/lib/java/com/google/android/material/sidesheet/SideSheetBehavior.java b/lib/java/com/google/android/material/sidesheet/SideSheetBehavior.java index 57e5b326c1e..acf274dae61 100644 --- a/lib/java/com/google/android/material/sidesheet/SideSheetBehavior.java +++ b/lib/java/com/google/android/material/sidesheet/SideSheetBehavior.java @@ -50,7 +50,6 @@ import androidx.core.view.accessibility.AccessibilityViewCommand; import androidx.customview.view.AbsSavedState; import androidx.customview.widget.ViewDragHelper; -import com.google.android.material.internal.ViewUtils; import com.google.android.material.resources.MaterialResources; import com.google.android.material.shape.MaterialShapeDrawable; import com.google.android.material.shape.ShapeAppearanceModel; @@ -343,11 +342,7 @@ private int calculateCurrentOffset(int savedOutwardEdge, V child) { switch (state) { case STATE_EXPANDED: - // TODO (b/261619910): This is a workaround for a bug where the expanded offset was getting - // recalculated if onLayoutChild() was called while the sheet was in the process of - // expanding/offsetting. Revisit this and refactor if necessary when adding left based - // sheets. - currentOffset = ViewUtils.isLayoutRtl(child) ? getExpandedOffset() : 0; + currentOffset = 0; break; case STATE_DRAGGING: case STATE_SETTLING: diff --git a/lib/java/com/google/android/material/sidesheet/res/layout/m3_side_sheet_dialog.xml b/lib/java/com/google/android/material/sidesheet/res/layout/m3_side_sheet_dialog.xml index 319bf7415b4..e20c55dc4f7 100644 --- a/lib/java/com/google/android/material/sidesheet/res/layout/m3_side_sheet_dialog.xml +++ b/lib/java/com/google/android/material/sidesheet/res/layout/m3_side_sheet_dialog.xml @@ -43,7 +43,6 @@ style="?attr/sideSheetModalStyle" android:layout_width="@dimen/m3_side_sheet_width" android:layout_height="match_parent" - android:layout_gravity="end" app:layout_behavior="@string/side_sheet_behavior"/> diff --git a/lib/java/com/google/android/material/sidesheet/res/values/styles.xml b/lib/java/com/google/android/material/sidesheet/res/values/styles.xml index 7aa4ecf7cdd..2b2e2c2f8cc 100644 --- a/lib/java/com/google/android/material/sidesheet/res/values/styles.xml +++ b/lib/java/com/google/android/material/sidesheet/res/values/styles.xml @@ -24,7 +24,7 @@ set layout_* attributes from this style, because this style always needs to be explicitly set on the behavior's associated View in the layout. --> - end + right @dimen/m3_side_sheet_standard_elevation