I have a viewgroup with BottomSheetBehaviour from MaterialComponents (the sheet content is clickable, hidable)
The layout included in parent (CooridnatorLayout)
<include
android:id="@+id/filters_sheet"
layout="@layout/station_filters"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:behavior_hideable="true"
app:behavior_peekHeight="48dp"
app:behavior_skipCollapsed="true"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"/>
The content of sheet has 2 switch components (for filtering the list behind sheet)
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/filter_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:layout_gravity="bottom"
android:background="@drawable/filters_sheet_background"
android:elevation="@dimen/small_space">
<Switch
android:id="@+id/station_filter_only_available"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space"
android:padding="@dimen/space"
android:text="@string/station_filter_only_available" />
<Switch
android:id="@+id/station_filter_with_partners"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/space"
android:text="@string/station_filter_with_partners"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Now each time I click on any filter switch, the list is updated (by triggering new value on live data) but the sheet disappears, but internal state of BottomSheetBehaviour is still STATE_EXPANDED.
Is this a bug in library (com.google.android.material:material:1.0.0) or I'm missing something?
Thanks
station_filter_only_available.setOnCheckedChangeListener { _, isChecked ->
if (parentViewModel.stationFilters.value != null) {
parentViewModel.stationFilters.value = parentViewModel.stationFilters.value!!.copy(onlyAvailable = isChecked)
}
}