diff --git a/changelog.d/7102.bugfix b/changelog.d/7102.bugfix new file mode 100644 index 0000000000..73d1bbc7d6 --- /dev/null +++ b/changelog.d/7102.bugfix @@ -0,0 +1 @@ +Fixes crash when quickly double clicking FABs in the new app layout diff --git a/vector/src/main/java/im/vector/app/features/home/NewHomeDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/NewHomeDetailFragment.kt index 3681ba4c15..f31f8a7d92 100644 --- a/vector/src/main/java/im/vector/app/features/home/NewHomeDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/NewHomeDetailFragment.kt @@ -201,13 +201,12 @@ class NewHomeDetailFragment : private fun setupFabs() { showFABs() - views.newLayoutCreateChatButton.setOnClickListener { - newChatBottomSheet.show(requireActivity().supportFragmentManager, NewChatBottomSheet.TAG) + views.newLayoutCreateChatButton.debouncedClicks { + newChatBottomSheet.takeIf { !it.isAdded }?.show(requireActivity().supportFragmentManager, NewChatBottomSheet.TAG) } - views.newLayoutOpenSpacesButton.setOnClickListener { - // Click action for open spaces modal goes here - spaceListBottomSheet.show(requireActivity().supportFragmentManager, SpaceListBottomSheet.TAG) + views.newLayoutOpenSpacesButton.debouncedClicks { + spaceListBottomSheet.takeIf { !it.isAdded }?.show(requireActivity().supportFragmentManager, SpaceListBottomSheet.TAG) } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt index 05b86f7393..1d8a70c3bb 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt @@ -27,7 +27,7 @@ import im.vector.app.features.navigation.Navigator import javax.inject.Inject @AndroidEntryPoint -class NewChatBottomSheet @Inject constructor() : BottomSheetDialogFragment() { +class NewChatBottomSheet : BottomSheetDialogFragment() { @Inject lateinit var navigator: Navigator