-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New App Layout: Adds New Chat Bottom Sheet #6801
Changes from 4 commits
c0c0f90
4f4d7f1
7a50e25
989471a
f119de4
ce8939a
8996734
90ab40d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds new chat bottom sheet as the click action of the main FAB in the new app layout |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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(), "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
|
||
companion object { | ||
const val TAG = "NewChatBottomSheet" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:id="@+id/start_chat" | ||
style="@style/Widget.Vector.TextView.Subtitle" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="?selectableItemBackground" | ||
android:paddingHorizontal="16dp" | ||
android:paddingVertical="16dp" | ||
android:text="@string/start_chat" | ||
android:textAppearance="@style/TextAppearance.Vector.Body" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you apply both |
||
android:textColor="?vctr_content_primary" /> | ||
|
||
<TextView | ||
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="16dp" | ||
android:text="@string/create_room" | ||
android:textAppearance="@style/TextAppearance.Vector.Body" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
android:textColor="?vctr_content_primary" /> | ||
|
||
</LinearLayout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Wdyt about creating the bottom sheet instance here instead of a class variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't prefer doing it this way because we're creating new instances of the bottom sheet every time and adding it to memory