forked from GitHub-Mirror/riotX-android
Fix / visibility bug after scroll
+ refine animation
This commit is contained in:
parent
90a011c4e4
commit
1206107a73
@ -93,7 +93,8 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
|
||||
}
|
||||
|
||||
// Hide FAB when list is scrolling
|
||||
epoxyRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
epoxyRecyclerView.addOnScrollListener(
|
||||
object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
createChatFabMenu.removeCallbacks(showFabRunnable)
|
||||
|
||||
@ -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))
|
||||
|
@ -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() {
|
||||
|
@ -6,12 +6,44 @@
|
||||
<Transition
|
||||
motion:constraintSetEnd="@+id/constraint_set_fab_menu_open"
|
||||
motion:constraintSetStart="@+id/constraint_set_fab_menu_close"
|
||||
motion:duration="200">
|
||||
motion:motionInterpolator="easeInOut"
|
||||
motion:duration="300">
|
||||
|
||||
<OnClick
|
||||
motion:clickAction="toggle"
|
||||
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>
|
||||
|
||||
<ConstraintSet android:id="@+id/constraint_set_fab_menu_close" >
|
||||
@ -96,7 +128,7 @@
|
||||
|
||||
</ConstraintSet>
|
||||
|
||||
<ConstraintSet android:id="@+id/constraint_set_fab_menu_open">
|
||||
<ConstraintSet android:id="@+id/constraint_set_fab_menu_open" >
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/createRoomTouchGuard"
|
||||
|
Loading…
Reference in New Issue
Block a user