Skip to content

Commit a24832a

Browse files
afohrmandsn5ft
authored andcommitted
[Adaptive][Side Sheet] Fixed issue where sheet would jump to the far edge of the screen in RTL without temporary fix.
PiperOrigin-RevId: 495687169 (cherry picked from commit 2fd2d66)
1 parent 280a01c commit a24832a

File tree

4 files changed

+2
-11
lines changed

4 files changed

+2
-11
lines changed

catalog/java/io/material/catalog/sidesheet/res/layout/cat_sidesheet_fragment.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
style="@style/Widget.Material3.SideSheet"
8484
android:layout_width="256dp"
8585
android:layout_height="match_parent"
86-
android:layout_gravity="end"
8786
android:orientation="vertical"
8887
app:layout_behavior="@string/side_sheet_behavior"
8988
tools:targetApi="lollipop">
@@ -95,7 +94,6 @@
9594
style="@style/Widget.Material3.SideSheet"
9695
android:layout_width="256dp"
9796
android:layout_height="match_parent"
98-
android:layout_gravity="end"
9997
android:orientation="vertical"
10098
app:layout_behavior="@string/side_sheet_behavior"
10199
tools:targetApi="lollipop">
@@ -107,7 +105,6 @@
107105
style="@style/Widget.Material3.SideSheet"
108106
android:layout_width="256dp"
109107
android:layout_height="match_parent"
110-
android:layout_gravity="end"
111108
android:orientation="vertical"
112109
app:coplanarSiblingViewId="@id/nested_scroll_view"
113110
app:layout_behavior="@string/side_sheet_behavior"

lib/java/com/google/android/material/sidesheet/SideSheetBehavior.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import androidx.core.view.accessibility.AccessibilityViewCommand;
5151
import androidx.customview.view.AbsSavedState;
5252
import androidx.customview.widget.ViewDragHelper;
53-
import com.google.android.material.internal.ViewUtils;
5453
import com.google.android.material.resources.MaterialResources;
5554
import com.google.android.material.shape.MaterialShapeDrawable;
5655
import com.google.android.material.shape.ShapeAppearanceModel;
@@ -343,11 +342,7 @@ private int calculateCurrentOffset(int savedOutwardEdge, V child) {
343342

344343
switch (state) {
345344
case STATE_EXPANDED:
346-
// TODO (b/261619910): This is a workaround for a bug where the expanded offset was getting
347-
// recalculated if onLayoutChild() was called while the sheet was in the process of
348-
// expanding/offsetting. Revisit this and refactor if necessary when adding left based
349-
// sheets.
350-
currentOffset = ViewUtils.isLayoutRtl(child) ? getExpandedOffset() : 0;
345+
currentOffset = 0;
351346
break;
352347
case STATE_DRAGGING:
353348
case STATE_SETTLING:

lib/java/com/google/android/material/sidesheet/res/layout/m3_side_sheet_dialog.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
style="?attr/sideSheetModalStyle"
4444
android:layout_width="@dimen/m3_side_sheet_width"
4545
android:layout_height="match_parent"
46-
android:layout_gravity="end"
4746
app:layout_behavior="@string/side_sheet_behavior"/>
4847

4948
</androidx.coordinatorlayout.widget.CoordinatorLayout>

lib/java/com/google/android/material/sidesheet/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
set layout_* attributes from this style, because this style always
2525
needs to be explicitly set on the behavior's associated View in the
2626
layout. -->
27-
<item name="android:layout_gravity">end</item>
27+
<item name="android:layout_gravity">right</item>
2828
<item name="android:elevation" tools:ignore="NewApi">@dimen/m3_side_sheet_standard_elevation</item>
2929
</style>
3030

0 commit comments

Comments
 (0)