Fixes bug where bottom sheet sometimes renders with the wrong height

This commit is contained in:
ericdecanini 2022-08-03 21:54:05 +02:00
parent aa24debd87
commit 5d183654b1
4 changed files with 91 additions and 86 deletions

View File

@ -64,6 +64,8 @@ class HomeRoomListFragment @Inject constructor(
private var concatAdapter = ConcatAdapter()
private var modelBuildListener: OnModelBuildFinishedListener? = null
private val spacesBottomSheet = SpacesBottomSheet()
private lateinit var stateRestorer: LayoutManagerStateRestorer
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentRoomListBinding {
@ -120,7 +122,7 @@ class HomeRoomListFragment @Inject constructor(
views.newLayoutOpenSpacesButton.setOnClickListener {
// Click action for open spaces modal goes here
SpacesBottomSheet().show(requireActivity().supportFragmentManager, SpacesBottomSheet.TAG)
spacesBottomSheet.show(requireActivity().supportFragmentManager, SpacesBottomSheet.TAG)
}
// Hide FABs when list is scrolling

View File

@ -143,7 +143,7 @@ class SpaceListFragment @Inject constructor(
}
if (vectorFeatures.isNewAppLayoutEnabled()) {
newSpaceController.update(state)
newSpaceController.update(state).also { onUpdate?.invoke() }
} else {
spaceController.update(state)
}

View File

@ -31,13 +31,10 @@ class SpacesBottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragmentSpacesBottomSheetBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
if (savedInstanceState == null) {
replaceChildFragment(R.id.space_list, SpaceListFragment::class.java)
}
return binding.root
}
companion object {

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<im.vector.app.core.platform.StateView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<im.vector.app.core.platform.StateView
android:id="@+id/stateView"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -76,8 +80,8 @@
app:layout_constraintEnd_toEndOf="@id/newLayoutCreateChatButton"
app:layout_constraintStart_toStartOf="@id/newLayoutCreateChatButton"
app:tint="?attr/colorPrimary"
tools:visibility="visible"
tools:targetApi="lollipop_mr1" />
tools:targetApi="lollipop_mr1"
tools:visibility="visible" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
@ -93,9 +97,11 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible"
tools:targetApi="lollipop_mr1" />
tools:targetApi="lollipop_mr1"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</im.vector.app.core.platform.StateView>
</im.vector.app.core.platform.StateView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>