Finalises new layout FABs

This commit is contained in:
ericdecanini 2022-07-29 15:28:55 +02:00
parent d49f104332
commit 8e7e320e40
3 changed files with 46 additions and 34 deletions

View File

@ -211,14 +211,12 @@ class RoomListFragment @Inject constructor(
} }
private fun setupCreateRoomButton() { private fun setupCreateRoomButton() {
// TODO: Uncomment when (roomListParams.displayMode) {
// when (roomListParams.displayMode) { RoomListDisplayMode.NOTIFICATIONS -> views.createChatFabMenu.isVisible = true
// RoomListDisplayMode.NOTIFICATIONS -> views.createChatFabMenu.isVisible = true RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.isVisible = true
// RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.isVisible = false RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.isVisible = true
// RoomListDisplayMode.PEOPLE -> views.createChatRoomButton.isVisible = true RoomListDisplayMode.FILTERED -> Unit // No button in this mode
// RoomListDisplayMode.ROOMS -> views.createGroupRoomButton.isVisible = true }
// RoomListDisplayMode.FILTERED -> Unit // No button in this mode
// }
views.createChatRoomButton.debouncedClicks { views.createChatRoomButton.debouncedClicks {
fabCreateDirectChat() fabCreateDirectChat()

View File

@ -20,6 +20,7 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.ConcatAdapter import androidx.recyclerview.widget.ConcatAdapter
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -90,6 +91,7 @@ class HomeRoomListFragment @Inject constructor(
} }
setupRecyclerView() setupRecyclerView()
setupFabs()
} }
private fun setupRecyclerView() { private fun setupRecyclerView() {
@ -108,6 +110,19 @@ class HomeRoomListFragment @Inject constructor(
views.roomListView.adapter = concatAdapter views.roomListView.adapter = concatAdapter
} }
private fun setupFabs() {
views.newLayoutCreateChatButton.isVisible = true
views.newLayoutOpenSpacesButton.isVisible = true
views.newLayoutCreateChatButton.setOnClickListener {
// Click action for create chat modal goes here
}
views.newLayoutOpenSpacesButton.setOnClickListener {
// Click action for open spaces modal goes here
}
}
override fun invalidate() = withState(roomListViewModel) { state -> override fun invalidate() = withState(roomListViewModel) { state ->
views.stateView.state = state.state views.stateView.state = state.state
} }

View File

@ -56,46 +56,45 @@
tools:visibility="visible" /> tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="bottom|end" 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 <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/newLayoutOpenSpacesButton" android:id="@+id/newLayoutOpenSpacesButton"
style="@style/Widget.Vector.FloatingActionButton" style="@style/Widget.Vector.FloatingActionButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" android:layout_marginBottom="20dp"
android:accessibilityTraversalBefore="@id/roomListView" android:accessibilityTraversalAfter="@id/newLayoutCreateChatButton"
android:contentDescription="@string/a11y_create_room" android:contentDescription="@string/a11y_create_room"
android:src="@drawable/ic_open_spaces" android:src="@drawable/ic_open_spaces"
android:visibility="visible" android:visibility="gone"
app:backgroundTint="?attr/vctr_toolbar_background" app:backgroundTint="?attr/vctr_toolbar_background"
app:fabSize="mini" app:fabSize="mini"
app:layout_constraintBottom_toTopOf="@id/newLayoutCreateChatButton" app:layout_constraintBottom_toTopOf="@id/newLayoutCreateChatButton"
app:layout_constraintEnd_toEndOf="@id/newLayoutCreateChatButton" app:layout_constraintEnd_toEndOf="@id/newLayoutCreateChatButton"
app:layout_constraintStart_toStartOf="@id/newLayoutCreateChatButton" app:layout_constraintStart_toStartOf="@id/newLayoutCreateChatButton"
app:maxImageSize="32dp"
app:tint="?attr/colorPrimary" app:tint="?attr/colorPrimary"
tools:layout_marginEnd="144dp" tools:visibility="visible"
tools:visibility="visible" /> tools:targetApi="lollipop_mr1" />
<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:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:accessibilityTraversalBefore="@id/roomListView"
android:contentDescription="@string/a11y_create_room"
android:src="@drawable/ic_new_chat"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible"
tools:targetApi="lollipop_mr1" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>