Adds listeners to FABs

This commit is contained in:
ericdecanini 2022-08-10 15:25:33 +02:00
parent c0c0f90b04
commit 4f4d7f111d
3 changed files with 40 additions and 11 deletions

View File

@ -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)

View File

@ -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"
}

View File

@ -5,23 +5,29 @@
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:id="@+id/start_chat"
style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Vector.Subtitle"
android:textSize="18sp"
android:paddingVertical="8dp"
android:background="?selectableItemBackground"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp"
android:text="@string/start_chat"
android:textAppearance="@style/TextAppearance.Vector.Body"
android:textColor="?vctr_content_primary"
android:text="@string/start_chat" />
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:id="@+id/create_room"
style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp"
android:textAppearance="@style/TextAppearance.Vector.Subtitle"
android:textSize="18sp"
android:paddingVertical="16dp"
android:text="@string/create_room"
android:textAppearance="@style/TextAppearance.Vector.Body"
android:textColor="?vctr_content_primary"
android:text="@string/create_room" />
android:textStyle="bold" />
</LinearLayout>