diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 1667d68c3..3d634a516 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -273,7 +273,7 @@ class PhotoFragment : ViewPagerFragment() { } } - override fun onConfigurationChanged(newConfig: Configuration?) { + override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) loadImage() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index dee60aa8e..5914da11f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -51,6 +51,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mTouchDownY = 0f private var mTouchDownTime = 0L private var mTouchDownVolume = 0 + private var mLastTouchY = 0f private var mSlideInfoText = "" private var mSlideInfoFadeHandler = Handler() @@ -118,7 +119,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } } - override fun onConfigurationChanged(newConfig: Configuration?) { + override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) setVideoSize() initTimeHolder() @@ -133,6 +134,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee MotionEvent.ACTION_DOWN -> { mTouchDownX = event.x mTouchDownY = event.y + mLastTouchY = event.y mTouchDownTime = System.currentTimeMillis() mTouchDownVolume = getCurrentVolume() mSlideInfoText = "${getString(R.string.volume)}:\n" @@ -144,8 +146,15 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee if (Math.abs(diffY) > Math.abs(diffX)) { var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 percent = Math.min(100, Math.max(-100, percent)) + + if ((percent == 100 && event.y > mLastTouchY) || (percent == -100 && event.y < mLastTouchY)) { + mTouchDownY = event.y + mTouchDownVolume = getCurrentVolume() + } + volumePercentChanged(percent) } + mLastTouchY = event.y } MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) {