Merge pull request #6801 from vector-im/feature/eric/new-chat-bottom-sheet

New App Layout: Adds New Chat Bottom Sheet
This commit is contained in:
Eric Decanini 2022-08-19 15:22:06 +02:00 committed by GitHub
commit 11b4ea5227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 156 additions and 1 deletions

1
changelog.d/6801.wip Normal file
View File

@ -0,0 +1 @@
Adds new chat bottom sheet as the click action of the main FAB in the new app layout

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.detail.search.SearchFragment
import im.vector.app.features.home.room.list.RoomListFragment 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.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.home.room.threads.list.views.ThreadListFragment
import im.vector.app.features.location.LocationSharingFragment import im.vector.app.features.location.LocationSharingFragment
import im.vector.app.features.location.preview.LocationPreviewFragment import im.vector.app.features.location.preview.LocationPreviewFragment
@ -191,6 +192,11 @@ interface FragmentModule {
@FragmentKey(RoomListFragment::class) @FragmentKey(RoomListFragment::class)
fun bindRoomListFragment(fragment: RoomListFragment): Fragment fun bindRoomListFragment(fragment: RoomListFragment): Fragment
@Binds
@IntoMap
@FragmentKey(NewChatBottomSheet::class)
fun bindNewChatBottomSheetFragment(fragment: NewChatBottomSheet): Fragment
@Binds @Binds
@IntoMap @IntoMap
@FragmentKey(LocalePickerFragment::class) @FragmentKey(LocalePickerFragment::class)

View File

@ -74,6 +74,8 @@ class HomeRoomListFragment @Inject constructor(
private lateinit var stateRestorer: LayoutManagerStateRestorer private lateinit var stateRestorer: LayoutManagerStateRestorer
private val newChatBottomSheet = NewChatBottomSheet()
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentRoomListBinding { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentRoomListBinding {
return FragmentRoomListBinding.inflate(inflater, container, false) return FragmentRoomListBinding.inflate(inflater, container, false)
} }
@ -166,7 +168,7 @@ class HomeRoomListFragment @Inject constructor(
showFABs() showFABs()
views.newLayoutCreateChatButton.setOnClickListener { views.newLayoutCreateChatButton.setOnClickListener {
// Click action for create chat modal goes here (Issue #6717) newChatBottomSheet.show(requireActivity().supportFragmentManager, NewChatBottomSheet.TAG)
} }
views.newLayoutOpenSpacesButton.setOnClickListener { views.newLayoutOpenSpacesButton.setOnClickListener {

View File

@ -0,0 +1,59 @@
/*
* 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 dagger.hilt.android.AndroidEntryPoint
import im.vector.app.databinding.FragmentNewChatBottomSheetBinding
import im.vector.app.features.navigation.Navigator
import javax.inject.Inject
@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())
}
binding.exploreRooms.setOnClickListener {
navigator.openRoomDirectory(requireContext())
}
}
companion object {
const val TAG = "NewChatBottomSheet"
}
}

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12.283,21.44C17.649,21.44 22,17.088 22,11.719C22,6.351 17.649,1.999 12.283,1.999C6.916,1.999 2.566,6.351 2.566,11.719C2.566,13.223 2.907,14.648 3.517,15.918L2.045,20.705C1.808,21.474 2.531,22.194 3.299,21.953L8.046,20.47C9.326,21.091 10.764,21.44 12.283,21.44Z"
android:fillColor="#737D8C"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M17.048,4.105C17.107,3.556 16.708,3.064 16.159,3.006C15.61,2.948 15.118,3.346 15.059,3.895L14.668,7.602H9.613L9.983,4.105C10.041,3.556 9.642,3.064 9.093,3.006C8.544,2.948 8.052,3.346 7.994,3.895L7.602,7.602H4.834C4.281,7.602 3.834,8.05 3.834,8.602C3.834,9.154 4.281,9.602 4.834,9.602H7.39L6.872,14.505H4C3.448,14.505 3,14.953 3,15.505C3,16.058 3.448,16.506 4,16.506H6.661L6.331,19.622C6.273,20.171 6.671,20.663 7.221,20.721C7.77,20.779 8.262,20.381 8.32,19.832L8.589,17.288C8.319,16.818 8.165,16.274 8.165,15.693C8.165,14.871 8.474,14.122 8.984,13.555L9.401,9.602H12.959C13.538,8.776 14.497,8.235 15.583,8.235C16.669,8.235 17.628,8.776 18.207,9.602H19.379C19.931,9.602 20.379,9.154 20.379,8.602C20.379,8.05 19.931,7.602 19.379,7.602H16.679L17.048,4.105ZM15.583,10.382C16.135,10.382 16.583,10.83 16.583,11.382V14.693H19.852C20.404,14.693 20.852,15.141 20.852,15.693C20.852,16.246 20.404,16.694 19.852,16.694H16.583V20.004C16.583,20.557 16.135,21.004 15.583,21.004C15.031,21.004 14.583,20.557 14.583,20.004V16.694H11.313C10.76,16.694 10.313,16.246 10.313,15.693C10.313,15.141 10.76,14.693 11.313,14.693H14.583V11.382C14.583,10.83 15.031,10.382 15.583,10.382Z"
android:fillColor="#737D8C"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M16.647,3.006C17.196,3.065 17.593,3.558 17.533,4.108L17.147,7.684H19.998C20.55,7.684 20.998,8.132 20.998,8.684C20.998,9.236 20.55,9.684 19.998,9.684H16.931L16.8,10.891C16.058,10.967 15.356,11.181 14.722,11.508L14.919,9.684H9.582L9.039,14.708H11.898C11.67,15.332 11.545,16.006 11.544,16.708H8.822L8.455,20.111C8.395,20.66 7.902,21.057 7.353,20.997C6.804,20.938 6.407,20.445 6.466,19.896L6.811,16.708H3.999C3.447,16.708 2.999,16.26 2.999,15.708C2.999,15.156 3.447,14.708 3.999,14.708H7.027L7.57,9.684H4.864C4.312,9.684 3.864,9.236 3.864,8.684C3.864,8.132 4.312,7.684 4.864,7.684H7.786L8.196,3.893C8.255,3.344 8.748,2.947 9.298,3.006C9.847,3.065 10.244,3.558 10.184,4.108L9.798,7.684H15.135L15.545,3.893C15.604,3.344 16.097,2.947 16.647,3.006Z"
android:fillColor="#737D8C"
android:fillType="evenOdd"/>
<path
android:pathData="M19.003,16.765C19.003,17.817 18.151,18.669 17.1,18.669C16.048,18.669 15.196,17.817 15.196,16.765C15.196,15.714 16.048,14.862 17.1,14.862C18.151,14.862 19.003,15.714 19.003,16.765ZM20.332,18.698C20.67,18.133 20.865,17.472 20.865,16.765C20.865,14.686 19.179,13 17.1,13C15.02,13 13.334,14.686 13.334,16.765C13.334,18.845 15.02,20.531 17.1,20.531C17.806,20.531 18.467,20.336 19.032,19.998C19.062,20.038 19.094,20.077 19.131,20.114L20.745,21.727C21.108,22.091 21.698,22.091 22.061,21.727C22.425,21.364 22.425,20.774 22.061,20.411L20.448,18.797C20.411,18.76 20.372,18.728 20.332,18.698Z"
android:fillColor="#737D8C"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/start_chat"
style="@style/Widget.Vector.TextView.Body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:drawablePadding="16dp"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp"
android:text="@string/start_chat"
android:textColor="?vctr_content_primary"
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_chat" />
<TextView
android:id="@+id/create_room"
style="@style/Widget.Vector.TextView.Body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:drawablePadding="16dp"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp"
android:text="@string/create_room"
android:textColor="?vctr_content_primary"
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_room_add" />
<TextView
android:id="@+id/explore_rooms"
style="@style/Widget.Vector.TextView.Body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:drawablePadding="16dp"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp"
android:text="@string/explore_rooms"
android:textColor="?vctr_content_primary"
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_room_explore" />
</LinearLayout>

View File

@ -137,7 +137,10 @@
<!-- Home Screen --> <!-- Home Screen -->
<string name="all_chats">All Chats</string> <string name="all_chats">All Chats</string>
<string name="start_chat">Start Chat</string>
<string name="create_room">Create Room</string>
<string name="change_space">Change Space</string> <string name="change_space">Change Space</string>
<string name="explore_rooms">Explore Rooms</string>
<!-- Last seen time --> <!-- Last seen time -->