use Down animation at closing fullscreen view with a gesture

This commit is contained in:
tibbi 2021-03-07 22:49:41 +01:00
parent 34824e79ff
commit fa41371209

View file

@ -7,6 +7,7 @@ import android.view.MotionEvent
import androidx.exifinterface.media.ExifInterface import androidx.exifinterface.media.ExifInterface
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.extensions.config import com.simplemobiletools.gallery.pro.extensions.config
import com.simplemobiletools.gallery.pro.helpers.* import com.simplemobiletools.gallery.pro.helpers.*
import com.simplemobiletools.gallery.pro.models.Medium import com.simplemobiletools.gallery.pro.models.Medium
@ -145,7 +146,8 @@ abstract class ViewPagerFragment : Fragment() {
val downGestureDuration = System.currentTimeMillis() - mTouchDownTime val downGestureDuration = System.currentTimeMillis() - mTouchDownTime
if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && context?.config?.allowDownGesture == true) { if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && context?.config?.allowDownGesture == true) {
activity?.supportFinishAfterTransition() activity?.finish()
activity?.overridePendingTransition(0, R.anim.slide_down)
} }
mIgnoreCloseDown = false mIgnoreCloseDown = false
} }