forked from GitHub-Mirror/riotX-android
Fix / visibility bug after scroll
+ refine animation
This commit is contained in:
parent
90a011c4e4
commit
1206107a73
@ -93,25 +93,26 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hide FAB when list is scrolling
|
// Hide FAB when list is scrolling
|
||||||
epoxyRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
epoxyRecyclerView.addOnScrollListener(
|
||||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
object : RecyclerView.OnScrollListener() {
|
||||||
createChatFabMenu.removeCallbacks(showFabRunnable)
|
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||||
|
createChatFabMenu.removeCallbacks(showFabRunnable)
|
||||||
|
|
||||||
when (newState) {
|
when (newState) {
|
||||||
RecyclerView.SCROLL_STATE_IDLE -> {
|
RecyclerView.SCROLL_STATE_IDLE -> {
|
||||||
createChatFabMenu.postDelayed(showFabRunnable, 1000)
|
createChatFabMenu.postDelayed(showFabRunnable, 1000)
|
||||||
}
|
}
|
||||||
RecyclerView.SCROLL_STATE_DRAGGING,
|
RecyclerView.SCROLL_STATE_DRAGGING,
|
||||||
RecyclerView.SCROLL_STATE_SETTLING -> {
|
RecyclerView.SCROLL_STATE_SETTLING -> {
|
||||||
when (roomListParams.displayMode) {
|
when (roomListParams.displayMode) {
|
||||||
DisplayMode.HOME -> createChatFabMenu.hide()
|
DisplayMode.HOME -> createChatFabMenu.hide()
|
||||||
DisplayMode.PEOPLE -> createChatRoomButton.hide()
|
DisplayMode.PEOPLE -> createChatRoomButton.hide()
|
||||||
else -> createGroupRoomButton.hide()
|
else -> createGroupRoomButton.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -220,7 +221,7 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
|
|||||||
return super.onBackPressed()
|
return super.onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoomSummaryController.Callback **************************************************************
|
// RoomSummaryController.Callback **************************************************************
|
||||||
|
|
||||||
override fun onRoomSelected(room: RoomSummary) {
|
override fun onRoomSelected(room: RoomSummary) {
|
||||||
roomListViewModel.accept(RoomListActions.SelectRoom(room))
|
roomListViewModel.accept(RoomListActions.SelectRoom(room))
|
||||||
|
@ -19,6 +19,8 @@ package im.vector.riotredesign.features.home.room.list.widget
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
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.R
|
||||||
import im.vector.riotredesign.features.themes.ThemeUtils
|
import im.vector.riotredesign.features.themes.ThemeUtils
|
||||||
import kotlinx.android.synthetic.main.motion_fab_menu_merge.view.*
|
import kotlinx.android.synthetic.main.motion_fab_menu_merge.view.*
|
||||||
@ -62,14 +64,17 @@ class FabMenuView @JvmOverloads constructor(context: Context, attrs: AttributeSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun show() {
|
fun show() {
|
||||||
// Ensure visibility is well restored
|
isVisible = true
|
||||||
// FIXME It does not work, FAB is not visible, alpha is 0... And cannot set it to 1
|
|
||||||
|
|
||||||
createRoomButton.show()
|
createRoomButton.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hide() {
|
fun hide() {
|
||||||
createRoomButton.hide()
|
createRoomButton.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
||||||
|
override fun onHidden(fab: FloatingActionButton?) {
|
||||||
|
super.onHidden(fab)
|
||||||
|
isVisible = false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun closeFabMenu() {
|
private fun closeFabMenu() {
|
||||||
|
@ -6,12 +6,44 @@
|
|||||||
<Transition
|
<Transition
|
||||||
motion:constraintSetEnd="@+id/constraint_set_fab_menu_open"
|
motion:constraintSetEnd="@+id/constraint_set_fab_menu_open"
|
||||||
motion:constraintSetStart="@+id/constraint_set_fab_menu_close"
|
motion:constraintSetStart="@+id/constraint_set_fab_menu_close"
|
||||||
motion:duration="200">
|
motion:motionInterpolator="easeInOut"
|
||||||
|
motion:duration="300">
|
||||||
|
|
||||||
<OnClick
|
<OnClick
|
||||||
motion:clickAction="toggle"
|
motion:clickAction="toggle"
|
||||||
motion:targetId="@+id/createRoomButton" />
|
motion:targetId="@+id/createRoomButton" />
|
||||||
|
|
||||||
|
<KeyFrameSet>
|
||||||
|
|
||||||
|
<!-- First icon goes up quickly to let room for other-->
|
||||||
|
<KeyPosition
|
||||||
|
motion:motionTarget="@id/createRoomItemGroup"
|
||||||
|
motion:framePosition="50"
|
||||||
|
motion:percentX="0.8"
|
||||||
|
motion:percentY="0.8"
|
||||||
|
motion:keyPositionType="deltaRelative"
|
||||||
|
/>
|
||||||
|
<KeyPosition
|
||||||
|
motion:motionTarget="@id/createRoomItemGroupLabel"
|
||||||
|
motion:framePosition="50"
|
||||||
|
motion:percentX="0.9"
|
||||||
|
motion:percentY="0.8"
|
||||||
|
motion:keyPositionType="deltaRelative"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Delay apparition of labels-->
|
||||||
|
<KeyAttribute
|
||||||
|
motion:motionTarget="@id/createRoomItemChatLabel"
|
||||||
|
android:alpha="0.4"
|
||||||
|
motion:framePosition="80"
|
||||||
|
/>
|
||||||
|
<KeyAttribute
|
||||||
|
motion:motionTarget="@id/createRoomItemGroupLabel"
|
||||||
|
android:alpha="0.4"
|
||||||
|
motion:framePosition="80"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</KeyFrameSet>
|
||||||
</Transition>
|
</Transition>
|
||||||
|
|
||||||
<ConstraintSet android:id="@+id/constraint_set_fab_menu_close" >
|
<ConstraintSet android:id="@+id/constraint_set_fab_menu_close" >
|
||||||
@ -96,7 +128,7 @@
|
|||||||
|
|
||||||
</ConstraintSet>
|
</ConstraintSet>
|
||||||
|
|
||||||
<ConstraintSet android:id="@+id/constraint_set_fab_menu_open">
|
<ConstraintSet android:id="@+id/constraint_set_fab_menu_open" >
|
||||||
|
|
||||||
<Constraint
|
<Constraint
|
||||||
android:id="@+id/createRoomTouchGuard"
|
android:id="@+id/createRoomTouchGuard"
|
||||||
|
Loading…
Reference in New Issue
Block a user