diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomListFragment.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomListFragment.kt index e354be2f74..e7b8b8378a 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomListFragment.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomListFragment.kt @@ -93,25 +93,26 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O } // Hide FAB when list is scrolling - epoxyRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { - override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { - createChatFabMenu.removeCallbacks(showFabRunnable) + epoxyRecyclerView.addOnScrollListener( + object : RecyclerView.OnScrollListener() { + override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { + createChatFabMenu.removeCallbacks(showFabRunnable) - when (newState) { - RecyclerView.SCROLL_STATE_IDLE -> { - createChatFabMenu.postDelayed(showFabRunnable, 1000) - } - RecyclerView.SCROLL_STATE_DRAGGING, - RecyclerView.SCROLL_STATE_SETTLING -> { - when (roomListParams.displayMode) { - DisplayMode.HOME -> createChatFabMenu.hide() - DisplayMode.PEOPLE -> createChatRoomButton.hide() - else -> createGroupRoomButton.hide() + when (newState) { + RecyclerView.SCROLL_STATE_IDLE -> { + createChatFabMenu.postDelayed(showFabRunnable, 1000) + } + RecyclerView.SCROLL_STATE_DRAGGING, + RecyclerView.SCROLL_STATE_SETTLING -> { + when (roomListParams.displayMode) { + DisplayMode.HOME -> createChatFabMenu.hide() + DisplayMode.PEOPLE -> createChatRoomButton.hide() + else -> createGroupRoomButton.hide() + } + } } } - } - } - }) + }) } @@ -220,7 +221,7 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O return super.onBackPressed() } - // RoomSummaryController.Callback ************************************************************** +// RoomSummaryController.Callback ************************************************************** override fun onRoomSelected(room: RoomSummary) { roomListViewModel.accept(RoomListActions.SelectRoom(room)) diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/widget/FabMenuView.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/widget/FabMenuView.kt index 7b8fb78c4c..9210e7ac2e 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/widget/FabMenuView.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/widget/FabMenuView.kt @@ -19,6 +19,8 @@ package im.vector.riotredesign.features.home.room.list.widget import android.content.Context import android.util.AttributeSet import androidx.constraintlayout.motion.widget.MotionLayout +import androidx.core.view.isVisible +import com.google.android.material.floatingactionbutton.FloatingActionButton import im.vector.riotredesign.R import im.vector.riotredesign.features.themes.ThemeUtils import kotlinx.android.synthetic.main.motion_fab_menu_merge.view.* @@ -62,14 +64,17 @@ class FabMenuView @JvmOverloads constructor(context: Context, attrs: AttributeSe } fun show() { - // Ensure visibility is well restored - // FIXME It does not work, FAB is not visible, alpha is 0... And cannot set it to 1 - + isVisible = true createRoomButton.show() } fun hide() { - createRoomButton.hide() + createRoomButton.hide(object : FloatingActionButton.OnVisibilityChangedListener() { + override fun onHidden(fab: FloatingActionButton?) { + super.onHidden(fab) + isVisible = false + } + }) } private fun closeFabMenu() { diff --git a/vector/src/main/res/xml/motion_scene_fab_menu.xml b/vector/src/main/res/xml/motion_scene_fab_menu.xml index fc363cfccf..5cbf8bcd5b 100644 --- a/vector/src/main/res/xml/motion_scene_fab_menu.xml +++ b/vector/src/main/res/xml/motion_scene_fab_menu.xml @@ -6,12 +6,44 @@ + motion:motionInterpolator="easeInOut" + motion:duration="300"> + + + + + + + + + + + @@ -96,7 +128,7 @@ - +