From c0c0f90b042f3da543de0df600a76effcd583034 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Wed, 10 Aug 2022 11:26:25 +0200 Subject: [PATCH] Adds NewChatBottomSheet --- .../room/list/home/HomeRoomListFragment.kt | 4 +- .../home/room/list/home/NewChatBottomSheet.kt | 38 +++++++++++++++++++ .../layout/fragment_new_chat_bottom_sheet.xml | 27 +++++++++++++ vector/src/main/res/values/strings.xml | 2 + 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt create mode 100644 vector/src/main/res/layout/fragment_new_chat_bottom_sheet.xml diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt index 43a6f25841..0c9cb3136e 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt @@ -68,6 +68,8 @@ class HomeRoomListFragment @Inject constructor( private lateinit var stateRestorer: LayoutManagerStateRestorer + private val newChatBottomSheet = NewChatBottomSheet() + override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentRoomListBinding { return FragmentRoomListBinding.inflate(inflater, container, false) } @@ -117,7 +119,7 @@ class HomeRoomListFragment @Inject constructor( showFABs() views.newLayoutCreateChatButton.setOnClickListener { - // Click action for create chat modal goes here (Issue #6717) + newChatBottomSheet.show(requireActivity().supportFragmentManager, NewChatBottomSheet.TAG) } views.newLayoutOpenSpacesButton.setOnClickListener { 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 new file mode 100644 index 0000000000..836346e40e --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.home.room.list.home + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import im.vector.app.databinding.FragmentNewChatBottomSheetBinding + +class NewChatBottomSheet : BottomSheetDialogFragment() { + + private lateinit var binding: FragmentNewChatBottomSheetBinding + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + binding = FragmentNewChatBottomSheetBinding.inflate(inflater, container, false) + return binding.root + } + + 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 new file mode 100644 index 0000000000..8cfd4b3f31 --- /dev/null +++ b/vector/src/main/res/layout/fragment_new_chat_bottom_sheet.xml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 9fc9756897..9ea90a07d4 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -137,6 +137,8 @@ All Chats + Start chat + Create room