mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Finalises new layout FABs
This commit is contained in:
parent
d49f104332
commit
8e7e320e40
@ -211,14 +211,12 @@ class RoomListFragment @Inject constructor(
|
||||
}
|
||||
|
||||
private fun setupCreateRoomButton() {
|
||||
// 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
|
||||
// }
|
||||
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
|
||||
}
|
||||
|
||||
views.createChatRoomButton.debouncedClicks {
|
||||
fabCreateDirectChat()
|
||||
|
@ -20,6 +20,7 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.ConcatAdapter
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@ -90,6 +91,7 @@ class HomeRoomListFragment @Inject constructor(
|
||||
}
|
||||
|
||||
setupRecyclerView()
|
||||
setupFabs()
|
||||
}
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
@ -108,6 +110,19 @@ class HomeRoomListFragment @Inject constructor(
|
||||
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 ->
|
||||
views.stateView.state = state.state
|
||||
}
|
||||
|
@ -56,46 +56,45 @@
|
||||
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" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|end">
|
||||
|
||||
<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:layout_marginBottom="20dp"
|
||||
android:accessibilityTraversalAfter="@id/newLayoutCreateChatButton"
|
||||
android:contentDescription="@string/a11y_create_room"
|
||||
android:src="@drawable/ic_open_spaces"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
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" />
|
||||
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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user