mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
hide the video play/pause button faster
This commit is contained in:
parent
cb4d86461e
commit
5d419ea88a
2 changed files with 9 additions and 11 deletions
|
@ -30,9 +30,7 @@ import com.simplemobiletools.gallery.R
|
|||
import com.simplemobiletools.gallery.activities.PanoramaVideoActivity
|
||||
import com.simplemobiletools.gallery.activities.VideoActivity
|
||||
import com.simplemobiletools.gallery.extensions.*
|
||||
import com.simplemobiletools.gallery.helpers.MEDIUM
|
||||
import com.simplemobiletools.gallery.helpers.MediaSideScroll
|
||||
import com.simplemobiletools.gallery.helpers.PATH
|
||||
import com.simplemobiletools.gallery.helpers.*
|
||||
import com.simplemobiletools.gallery.models.Medium
|
||||
import kotlinx.android.synthetic.main.pager_video_item.view.*
|
||||
import java.io.File
|
||||
|
@ -40,8 +38,6 @@ import java.io.File
|
|||
class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, SeekBar.OnSeekBarChangeListener {
|
||||
private val PROGRESS = "progress"
|
||||
private val MIN_SKIP_LENGTH = 2000
|
||||
private val HIDE_PAUSE_DELAY = 2000L
|
||||
private val PLAY_PAUSE_VISIBLE_ALPHA = 0.8f
|
||||
|
||||
private var mTextureView: TextureView? = null
|
||||
private var mCurrTimeView: TextView? = null
|
||||
|
@ -50,7 +46,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
private var mExoPlayer: SimpleExoPlayer? = null
|
||||
private var mVideoSize = Point(0, 0)
|
||||
private var mTimerHandler = Handler()
|
||||
private var mHidePauseHandler = Handler()
|
||||
private var mHidePlayPauseHandler = Handler()
|
||||
|
||||
private var mIsPlaying = false
|
||||
private var mIsDragged = false
|
||||
|
@ -394,7 +390,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
return
|
||||
|
||||
mIsPlaying = !mIsPlaying
|
||||
mHidePauseHandler.removeCallbacksAndMessages(null)
|
||||
mHidePlayPauseHandler.removeCallbacksAndMessages(null)
|
||||
if (mIsPlaying) {
|
||||
playVideo()
|
||||
} else {
|
||||
|
@ -440,10 +436,10 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
}
|
||||
|
||||
private fun schedulePlayPauseFadeOut() {
|
||||
mHidePauseHandler.removeCallbacksAndMessages(null)
|
||||
mHidePauseHandler.postDelayed({
|
||||
mHidePlayPauseHandler.removeCallbacksAndMessages(null)
|
||||
mHidePlayPauseHandler.postDelayed({
|
||||
mView!!.video_play_outline.animate().alpha(0f).start()
|
||||
}, HIDE_PAUSE_DELAY)
|
||||
}, HIDE_PLAY_PAUSE_DELAY)
|
||||
}
|
||||
|
||||
private fun videoEnded() = mExoPlayer?.currentPosition ?: 0 >= mExoPlayer?.duration ?: 0
|
||||
|
@ -499,7 +495,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
releaseExoPlayer()
|
||||
mSeekBar?.progress = 0
|
||||
mTimerHandler.removeCallbacksAndMessages(null)
|
||||
mHidePauseHandler.removeCallbacksAndMessages(null)
|
||||
mHidePlayPauseHandler.removeCallbacksAndMessages(null)
|
||||
mTextureView = null
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ const val SHOW_TEMP_HIDDEN_DURATION = 300000L
|
|||
const val CLICK_MAX_DURATION = 150
|
||||
const val DRAG_THRESHOLD = 8
|
||||
const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L
|
||||
const val HIDE_PLAY_PAUSE_DELAY = 500L
|
||||
const val PLAY_PAUSE_VISIBLE_ALPHA = 0.8f
|
||||
|
||||
const val DIRECTORY = "directory"
|
||||
const val MEDIUM = "medium"
|
||||
|
|
Loading…
Reference in a new issue