From 4f4d7f111d1106a17ebc819195ed75f1362c5628 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Wed, 10 Aug 2022 15:25:33 +0200 Subject: [PATCH] Adds listeners to FABs --- .../im/vector/app/core/di/FragmentModule.kt | 6 +++++ .../home/room/list/home/NewChatBottomSheet.kt | 19 +++++++++++++- .../layout/fragment_new_chat_bottom_sheet.xml | 26 ++++++++++++------- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/di/FragmentModule.kt b/vector/src/main/java/im/vector/app/core/di/FragmentModule.kt index e86b350534..fb6d6d64b8 100644 --- a/vector/src/main/java/im/vector/app/core/di/FragmentModule.kt +++ b/vector/src/main/java/im/vector/app/core/di/FragmentModule.kt @@ -63,6 +63,7 @@ import im.vector.app.features.home.room.detail.TimelineFragment import im.vector.app.features.home.room.detail.search.SearchFragment import im.vector.app.features.home.room.list.RoomListFragment import im.vector.app.features.home.room.list.home.HomeRoomListFragment +import im.vector.app.features.home.room.list.home.NewChatBottomSheet import im.vector.app.features.home.room.threads.list.views.ThreadListFragment import im.vector.app.features.location.LocationSharingFragment import im.vector.app.features.location.preview.LocationPreviewFragment @@ -209,6 +210,11 @@ interface FragmentModule { @FragmentKey(RoomListFragment::class) fun bindRoomListFragment(fragment: RoomListFragment): Fragment + @Binds + @IntoMap + @FragmentKey(NewChatBottomSheet::class) + fun bindNewChatBottomSheetFragment(fragment: NewChatBottomSheet): Fragment + @Binds @IntoMap @FragmentKey(LocalePickerFragment::class) 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 836346e40e..93558f0d9d 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 @@ -21,17 +21,34 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import dagger.hilt.android.AndroidEntryPoint import im.vector.app.databinding.FragmentNewChatBottomSheetBinding +import im.vector.app.features.navigation.Navigator +import javax.inject.Inject -class NewChatBottomSheet : BottomSheetDialogFragment() { +@AndroidEntryPoint +class NewChatBottomSheet @Inject constructor() : BottomSheetDialogFragment() { + + @Inject lateinit var navigator: Navigator private lateinit var binding: FragmentNewChatBottomSheetBinding override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { binding = FragmentNewChatBottomSheetBinding.inflate(inflater, container, false) + initFABs() return binding.root } + private fun initFABs() { + binding.startChat.setOnClickListener { + navigator.openCreateDirectRoom(requireActivity()) + } + + binding.createRoom.setOnClickListener { + navigator.openCreateRoom(requireActivity(), "") + } + } + companion object { const val TAG = "NewChatBottomSheet" } diff --git a/vector/src/main/res/layout/fragment_new_chat_bottom_sheet.xml b/vector/src/main/res/layout/fragment_new_chat_bottom_sheet.xml index 8cfd4b3f31..dcb727d73f 100644 --- a/vector/src/main/res/layout/fragment_new_chat_bottom_sheet.xml +++ b/vector/src/main/res/layout/fragment_new_chat_bottom_sheet.xml @@ -5,23 +5,29 @@ android:orientation="vertical"> + android:textStyle="bold" /> + android:textStyle="bold" />