diff --git a/changelog.d/6693.feature b/changelog.d/6693.feature
new file mode 100644
index 0000000000..5e905766a9
--- /dev/null
+++ b/changelog.d/6693.feature
@@ -0,0 +1 @@
+Adds New App Layout FABs (hidden behind feature flag)
diff --git a/library/ui-styles/src/main/res/values/styles_buttons.xml b/library/ui-styles/src/main/res/values/styles_buttons.xml
index c8dcacb8ed..702f427cc0 100644
--- a/library/ui-styles/src/main/res/values/styles_buttons.xml
+++ b/library/ui-styles/src/main/res/values/styles_buttons.xml
@@ -65,4 +65,8 @@
- ?colorOnPrimary
+
+
diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt
index 02122a5ee1..43a6f25841 100644
--- a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt
+++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt
@@ -23,6 +23,7 @@ import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.ConcatAdapter
import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
import com.airbnb.epoxy.EpoxyControllerAdapter
import com.airbnb.epoxy.OnModelBuildFinishedListener
import com.airbnb.mvrx.fragmentViewModel
@@ -74,7 +75,7 @@ class HomeRoomListFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- sharedActionViewModel = activityViewModelProvider.get(RoomListQuickActionsSharedActionViewModel::class.java)
+ sharedActionViewModel = activityViewModelProvider[RoomListQuickActionsSharedActionViewModel::class.java]
sharedActionViewModel
.stream()
.onEach { handleQuickActions(it) }
@@ -93,6 +94,7 @@ class HomeRoomListFragment @Inject constructor(
}
setupRecyclerView()
+ setupFabs()
}
private fun setupRecyclerView() {
@@ -111,6 +113,41 @@ class HomeRoomListFragment @Inject constructor(
views.roomListView.adapter = concatAdapter
}
+ private fun setupFabs() {
+ showFABs()
+
+ views.newLayoutCreateChatButton.setOnClickListener {
+ // Click action for create chat modal goes here (Issue #6717)
+ }
+
+ views.newLayoutOpenSpacesButton.setOnClickListener {
+ // Click action for open spaces modal goes here (Issue #6499)
+ }
+
+ // Hide FABs when list is scrolling
+ views.roomListView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
+ override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
+ views.createChatFabMenu.handler.removeCallbacksAndMessages(null)
+
+ when (newState) {
+ RecyclerView.SCROLL_STATE_IDLE -> views.createChatFabMenu.postDelayed(::showFABs, 250)
+ RecyclerView.SCROLL_STATE_DRAGGING,
+ RecyclerView.SCROLL_STATE_SETTLING -> hideFABs()
+ }
+ }
+ })
+ }
+
+ private fun showFABs() {
+ views.newLayoutCreateChatButton.show()
+ views.newLayoutOpenSpacesButton.show()
+ }
+
+ private fun hideFABs() {
+ views.newLayoutCreateChatButton.hide()
+ views.newLayoutOpenSpacesButton.hide()
+ }
+
override fun invalidate() = withState(roomListViewModel) { state ->
views.stateView.state = state.state
}
diff --git a/vector/src/main/res/drawable/ic_new_chat.xml b/vector/src/main/res/drawable/ic_new_chat.xml
new file mode 100644
index 0000000000..ec3ef46fa4
--- /dev/null
+++ b/vector/src/main/res/drawable/ic_new_chat.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/vector/src/main/res/drawable/ic_open_spaces.xml b/vector/src/main/res/drawable/ic_open_spaces.xml
new file mode 100644
index 0000000000..180f71f1cd
--- /dev/null
+++ b/vector/src/main/res/drawable/ic_open_spaces.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/vector/src/main/res/layout/fragment_room_list.xml b/vector/src/main/res/layout/fragment_room_list.xml
index a8eec6ff3a..17d93eb98a 100644
--- a/vector/src/main/res/layout/fragment_room_list.xml
+++ b/vector/src/main/res/layout/fragment_room_list.xml
@@ -55,4 +55,47 @@
tools:layout_marginEnd="144dp"
tools:visibility="visible" />
+
+
+
+
+
+
+
+
+
diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml
index d1b2d237d9..9fc9756897 100644
--- a/vector/src/main/res/values/strings.xml
+++ b/vector/src/main/res/values/strings.xml
@@ -1811,7 +1811,9 @@
Open the create room menu
Close the create room menu…
Create a new direct conversation
- Create a new room
+ Create a new conversation or room
+ Create a new room
+ Open spaces list
Close keys backup banner
Jump to bottom