Skip to content

[BottomSheet] Ignores bottomSheetStyle and backgroundTint if shapeAppearance isn't set on tag #2200

@AfzalivE

Description

@AfzalivE

Description:

Consider this XML

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/navigation_fragment"
        android:name="com.sample.app.MyFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:behavior_hideable="true"
        app:behavior_peekHeight="458dp"
        app:layout_behavior="@string/bottom_sheet_behavior"
        app:backgroundTint="@color/black" />

And bottomSheetStyle is set in themes.xml, let's assume it sets a shapeAppearanceOverlay.

Unless app:shapeAppearance="@style/ShapeAppearance.Todoist.MaterialAlertDialog" is set in the tag above, the shapeAppearanceOverlay in the bottomSheetStyle and backgroundTint attribute are ignored.

Expected behavior:
backgroundTint and bottomSheetStyle should not be ignored. I guess even if it doesn't make sense to use bottomSheetStyle to build a ShapeAppearanceModel without a shapeAppearance specified, the backgroundTint shouldn't be ignored.

Another thing is that even if backgroundTint isn't specified, I believe if colorBackground is defined in the theme, it is also not currently respected unless a shapeAppearance is specified.

Material Library version: 1.3.0

Device: Google Pixel

To help us triage faster, please check to make sure you are using the latest version of the library.

I'm not using 1.4.0-alpha but I see that this code is the same as 1.3.0:
https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java#L1325

We also happily accept pull requests.

I would gladly take that if-block outside of the if (this.shapeThemingEnabled) { block and submit a PR if anyone agrees that, at the very least, the backgroundTint/colorBackground should be applied regardless of whether a shapeAppearance is specified or not.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions