Skip to content

Commit

Permalink
[Adaptive][Side Sheet] Fixed issue where sheet would jump to the far …
Browse files Browse the repository at this point in the history
…edge of the screen in RTL without temporary fix.

PiperOrigin-RevId: 495687169
(cherry picked from commit 2fd2d66)
  • Loading branch information
afohrman authored and dsn5ft committed Jan 5, 2023
1 parent 280a01c commit a24832a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
Expand Up @@ -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">
Expand All @@ -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">
Expand All @@ -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"
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down
Expand Up @@ -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"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
Expand Down
Expand Up @@ -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. -->
<item name="android:layout_gravity">end</item>
<item name="android:layout_gravity">right</item>
<item name="android:elevation" tools:ignore="NewApi">@dimen/m3_side_sheet_standard_elevation</item>
</style>

Expand Down

0 comments on commit a24832a

Please sign in to comment.