mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Adds fab buttons
This commit is contained in:
parent
a0534d8fcc
commit
d49f104332
6 changed files with 81 additions and 6 deletions
|
@ -65,4 +65,8 @@
|
|||
<item name="colorPrimary">?colorOnPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Vector.FloatingActionButton" parent="Widget.MaterialComponents.FloatingActionButton">
|
||||
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.Material3.FloatingActionButton</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -211,12 +211,14 @@ class RoomListFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun setupCreateRoomButton() {
|
||||
when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.NOTIFICATIONS -> views.createChatFabMenu.isVisible = true
|
||||
RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.isVisible = true
|
||||
RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.isVisible = true
|
||||
RoomListDisplayMode.FILTERED -> Unit // No button in this mode
|
||||
}
|
||||
// TODO: Uncomment
|
||||
// when (roomListParams.displayMode) {
|
||||
// RoomListDisplayMode.NOTIFICATIONS -> views.createChatFabMenu.isVisible = true
|
||||
// RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.isVisible = false
|
||||
// RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.isVisible = true
|
||||
// RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.isVisible = true
|
||||
// RoomListDisplayMode.FILTERED -> Unit // No button in this mode
|
||||
// }
|
||||
|
||||
views.createChatRoomButton.debouncedClicks {
|
||||
fabCreateDirectChat()
|
||||
|
|
10
vector/src/main/res/drawable/ic_new_chat.xml
Normal file
10
vector/src/main/res/drawable/ic_new_chat.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M9.615,8.501C9.576,8.54 9.549,8.591 9.537,8.646L9.121,10.667C9.08,10.867 9.249,11.046 9.444,11.008L11.412,10.627C11.466,10.617 11.516,10.59 11.555,10.551L19.916,2.131C20.026,2.021 20.028,1.839 19.921,1.726L18.369,0.086C18.262,-0.027 18.086,-0.029 17.976,0.082L9.615,8.501ZM-0,4.686L-0,16.906C-0,17.727 0.319,18.514 0.887,19.094C1.456,19.674 2.226,20 3.03,20L14.996,20C15.8,20 16.57,19.674 17.139,19.094C17.707,18.514 18.026,17.727 18.026,16.906L18.026,9.61C18.026,9.337 17.92,9.075 17.73,8.881C17.541,8.688 17.284,8.579 17.016,8.579C16.748,8.579 16.491,8.688 16.302,8.881C16.113,9.075 16.006,9.337 16.006,9.61L16.006,16.906C16.006,17.18 15.9,17.442 15.71,17.635C15.521,17.829 15.264,17.938 14.996,17.938L3.03,17.938C2.762,17.938 2.505,17.829 2.316,17.635C2.126,17.442 2.02,17.18 2.02,16.906L2.02,4.686C2.02,4.413 2.126,4.15 2.316,3.957C2.505,3.764 2.762,3.655 3.03,3.655L10.174,3.655C10.442,3.655 10.699,3.546 10.888,3.353C11.078,3.16 11.184,2.897 11.184,2.624C11.184,2.35 11.078,2.088 10.888,1.895C10.699,1.701 10.442,1.593 10.174,1.593L3.03,1.593C2.226,1.593 1.456,1.918 0.887,2.499C0.319,3.079 -0,3.866 -0,4.686Z"
|
||||
android:fillColor="#ffffff"
|
||||
android:fillType="evenOdd"/>
|
||||
</vector>
|
14
vector/src/main/res/drawable/ic_open_spaces.xml
Normal file
14
vector/src/main/res/drawable/ic_open_spaces.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M1,0C0.448,0 0,0.448 0,1V7.889C0,8.441 0.448,8.889 1,8.889H7.889C8.441,8.889 8.889,8.441 8.889,7.889V1C8.889,0.448 8.441,0 7.889,0H1ZM12.111,0C11.559,0 11.111,0.448 11.111,1V7.889C11.111,8.441 11.559,8.889 12.111,8.889H19C19.552,8.889 20,8.441 20,7.889V1C20,0.448 19.552,0 19,0H12.111ZM0,12.111C0,11.559 0.448,11.111 1,11.111H7.889C8.441,11.111 8.889,11.559 8.889,12.111V19C8.889,19.552 8.441,20 7.889,20H1C0.448,20 0,19.552 0,19V12.111ZM12.111,11.111C11.559,11.111 11.111,11.559 11.111,12.111V19C11.111,19.552 11.559,20 12.111,20H19C19.552,20 20,19.552 20,19V12.111C20,11.559 19.552,11.111 19,11.111H12.111Z"
|
||||
android:fillType="evenOdd"/>
|
||||
<path
|
||||
android:pathData="M2,1C2,1.552 1.552,2 1,2V-2C-0.657,-2 -2,-0.657 -2,1H2ZM2,7.889V1H-2V7.889H2ZM1,6.889C1.552,6.889 2,7.337 2,7.889H-2C-2,9.546 -0.657,10.889 1,10.889V6.889ZM7.889,6.889H1V10.889H7.889V6.889ZM6.889,7.889C6.889,7.337 7.337,6.889 7.889,6.889V10.889C9.546,10.889 10.889,9.546 10.889,7.889H6.889ZM6.889,1V7.889H10.889V1H6.889ZM7.889,2C7.337,2 6.889,1.552 6.889,1H10.889C10.889,-0.657 9.546,-2 7.889,-2V2ZM1,2H7.889V-2H1V2ZM13.111,1C13.111,1.552 12.663,2 12.111,2V-2C10.454,-2 9.111,-0.657 9.111,1H13.111ZM13.111,7.889V1H9.111V7.889H13.111ZM12.111,6.889C12.663,6.889 13.111,7.337 13.111,7.889H9.111C9.111,9.546 10.454,10.889 12.111,10.889V6.889ZM19,6.889H12.111V10.889H19V6.889ZM18,7.889C18,7.337 18.448,6.889 19,6.889V10.889C20.657,10.889 22,9.546 22,7.889H18ZM18,1V7.889H22V1H18ZM19,2C18.448,2 18,1.552 18,1H22C22,-0.657 20.657,-2 19,-2V2ZM12.111,2H19V-2H12.111V2ZM1,9.111C-0.657,9.111 -2,10.454 -2,12.111H2C2,12.663 1.552,13.111 1,13.111V9.111ZM7.889,9.111H1V13.111H7.889V9.111ZM10.889,12.111C10.889,10.454 9.546,9.111 7.889,9.111V13.111C7.337,13.111 6.889,12.663 6.889,12.111H10.889ZM10.889,19V12.111H6.889V19H10.889ZM7.889,22C9.546,22 10.889,20.657 10.889,19H6.889C6.889,18.448 7.337,18 7.889,18V22ZM1,22H7.889V18H1V22ZM-2,19C-2,20.657 -0.657,22 1,22V18C1.552,18 2,18.448 2,19H-2ZM-2,12.111V19H2V12.111H-2ZM13.111,12.111C13.111,12.663 12.663,13.111 12.111,13.111V9.111C10.454,9.111 9.111,10.454 9.111,12.111H13.111ZM13.111,19V12.111H9.111V19H13.111ZM12.111,18C12.663,18 13.111,18.448 13.111,19H9.111C9.111,20.657 10.454,22 12.111,22V18ZM19,18H12.111V22H19V18ZM18,19C18,18.448 18.448,18 19,18V22C20.657,22 22,20.657 22,19H18ZM18,12.111V19H22V12.111H18ZM19,13.111C18.448,13.111 18,12.663 18,12.111H22C22,10.454 20.657,9.111 19,9.111V13.111ZM12.111,13.111H19V9.111H12.111V13.111Z"
|
||||
android:fillColor="#0DBD8B"/>
|
||||
</group>
|
||||
</vector>
|
|
@ -55,4 +55,48 @@
|
|||
tools:layout_marginEnd="144dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/newLayoutCreateChatButton"
|
||||
style="@style/Widget.Vector.FloatingActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:accessibilityTraversalBefore="@id/roomListView"
|
||||
android:contentDescription="@string/a11y_create_room"
|
||||
android:src="@drawable/ic_new_chat"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:maxImageSize="32dp"
|
||||
tools:layout_marginEnd="144dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/newLayoutOpenSpacesButton"
|
||||
style="@style/Widget.Vector.FloatingActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:accessibilityTraversalBefore="@id/roomListView"
|
||||
android:contentDescription="@string/a11y_create_room"
|
||||
android:src="@drawable/ic_open_spaces"
|
||||
android:visibility="visible"
|
||||
app:backgroundTint="?attr/vctr_toolbar_background"
|
||||
app:fabSize="mini"
|
||||
app:layout_constraintBottom_toTopOf="@id/newLayoutCreateChatButton"
|
||||
app:layout_constraintEnd_toEndOf="@id/newLayoutCreateChatButton"
|
||||
app:layout_constraintStart_toStartOf="@id/newLayoutCreateChatButton"
|
||||
app:maxImageSize="32dp"
|
||||
app:tint="?attr/colorPrimary"
|
||||
tools:layout_marginEnd="144dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</im.vector.app.core.platform.StateView>
|
||||
|
|
|
@ -1810,6 +1810,7 @@
|
|||
<string name="a11y_create_menu_open">Open the create room menu</string>
|
||||
<string name="a11y_create_menu_close">Close the create room menu…</string>
|
||||
<string name="a11y_create_direct_message">Create a new direct conversation</string>
|
||||
<string name="a11y_create_message">Create a new conversation or room</string>
|
||||
<string name="a11y_create_room">Create a new room</string>
|
||||
<string name="a11y_close_keys_backup_banner">Close keys backup banner</string>
|
||||
<string name="a11y_jump_to_bottom">Jump to bottom</string>
|
||||
|
|
Loading…
Reference in a new issue