From c0c0f90b042f3da543de0df600a76effcd583034 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Wed, 10 Aug 2022 11:26:25 +0200 Subject: [PATCH 1/6] 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 From 4f4d7f111d1106a17ebc819195ed75f1362c5628 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Wed, 10 Aug 2022 15:25:33 +0200 Subject: [PATCH 2/6] 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" /> From 7a50e25bea563a230593ab13f49fae505b11f095 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Wed, 10 Aug 2022 17:34:16 +0200 Subject: [PATCH 3/6] Unbolds text --- .../src/main/res/layout/fragment_new_chat_bottom_sheet.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 dcb727d73f..266f5d7213 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 @@ -14,8 +14,7 @@ android:paddingVertical="16dp" android:text="@string/start_chat" android:textAppearance="@style/TextAppearance.Vector.Body" - android:textColor="?vctr_content_primary" - android:textStyle="bold" /> + android:textColor="?vctr_content_primary" /> + android:textColor="?vctr_content_primary" /> From 989471a409e217bacdd18ee998d639178cd29c89 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Wed, 10 Aug 2022 17:44:33 +0200 Subject: [PATCH 4/6] Adds changelog file --- changelog.d/6801.wip | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6801.wip diff --git a/changelog.d/6801.wip b/changelog.d/6801.wip new file mode 100644 index 0000000000..bb3bc9d7a1 --- /dev/null +++ b/changelog.d/6801.wip @@ -0,0 +1 @@ +Adds new chat bottom sheet as the click action of the main FAB in the new app layout From f119de43b78f6eeffad5cdd8170d0a744a01a2f6 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Wed, 17 Aug 2022 21:12:08 +0200 Subject: [PATCH 5/6] Adds explore rooms option to new chat bottom sheet --- .../home/room/list/home/NewChatBottomSheet.kt | 6 +++- vector/src/main/res/drawable/ic_chat.xml | 10 ++++++ vector/src/main/res/drawable/ic_room_add.xml | 10 ++++++ .../src/main/res/drawable/ic_room_explore.xml | 14 +++++++++ .../layout/fragment_new_chat_bottom_sheet.xml | 31 +++++++++++++++---- 5 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 vector/src/main/res/drawable/ic_chat.xml create mode 100644 vector/src/main/res/drawable/ic_room_add.xml create mode 100644 vector/src/main/res/drawable/ic_room_explore.xml 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 93558f0d9d..05b86f7393 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 @@ -45,7 +45,11 @@ class NewChatBottomSheet @Inject constructor() : BottomSheetDialogFragment() { } binding.createRoom.setOnClickListener { - navigator.openCreateRoom(requireActivity(), "") + navigator.openCreateRoom(requireActivity()) + } + + binding.exploreRooms.setOnClickListener { + navigator.openRoomDirectory(requireContext()) } } diff --git a/vector/src/main/res/drawable/ic_chat.xml b/vector/src/main/res/drawable/ic_chat.xml new file mode 100644 index 0000000000..fb10eae9c9 --- /dev/null +++ b/vector/src/main/res/drawable/ic_chat.xml @@ -0,0 +1,10 @@ + + + diff --git a/vector/src/main/res/drawable/ic_room_add.xml b/vector/src/main/res/drawable/ic_room_add.xml new file mode 100644 index 0000000000..8404ff2181 --- /dev/null +++ b/vector/src/main/res/drawable/ic_room_add.xml @@ -0,0 +1,10 @@ + + + diff --git a/vector/src/main/res/drawable/ic_room_explore.xml b/vector/src/main/res/drawable/ic_room_explore.xml new file mode 100644 index 0000000000..9811a09054 --- /dev/null +++ b/vector/src/main/res/drawable/ic_room_explore.xml @@ -0,0 +1,14 @@ + + + + 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 266f5d7213..af6f00cb9f 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 @@ -1,31 +1,50 @@ + android:textColor="?vctr_content_primary" + android:textSize="16sp" + app:drawableStartCompat="@drawable/ic_chat" /> + android:textColor="?vctr_content_primary" + android:textSize="16sp" + app:drawableStartCompat="@drawable/ic_room_add" /> + + From 899673495a1a6adb2d3dde43cb8f8c20d02dae64 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Wed, 17 Aug 2022 21:42:39 +0200 Subject: [PATCH 6/6] Changes copies on sheet actions --- .../src/main/res/layout/fragment_new_chat_bottom_sheet.xml | 2 +- vector/src/main/res/values/strings.xml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 af6f00cb9f..07c19b43eb 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 @@ -42,7 +42,7 @@ android:drawablePadding="16dp" android:paddingHorizontal="16dp" android:paddingVertical="16dp" - android:text="@string/space_explore_activity_title" + android:text="@string/explore_rooms" android:textColor="?vctr_content_primary" android:textSize="16sp" app:drawableStartCompat="@drawable/ic_room_explore" /> diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 54ff379d08..4502304cc7 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -137,9 +137,10 @@ All Chats - Start chat - Create room + Start Chat + Create Room Change Space + Explore Rooms