Close the image fragment only if the image has been dragged down

This commit is contained in:
davidoskky 2023-01-21 16:37:25 +01:00
parent 68bbf5b2d3
commit ddc72d85b0

View File

@ -46,7 +46,9 @@ class ImageFragment : Fragment() {
} }
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) { override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
activity?.finish() if (motionLayout?.currentState == binding?.root?.endState) {
activity?.finish()
}
} }
override fun onTransitionTrigger(motionLayout: MotionLayout?, triggerId: Int, positive: Boolean, progress: Float) { override fun onTransitionTrigger(motionLayout: MotionLayout?, triggerId: Int, positive: Boolean, progress: Float) {