mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
adding some play/pause improvements
This commit is contained in:
parent
50c6d4d102
commit
0f79cf9b8e
2 changed files with 21 additions and 2 deletions
|
@ -41,6 +41,7 @@ import com.simplemobiletools.gallery.pro.dialogs.SaveAsDialog
|
|||
import com.simplemobiletools.gallery.pro.dialogs.SlideshowDialog
|
||||
import com.simplemobiletools.gallery.pro.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.fragments.PhotoFragment
|
||||
import com.simplemobiletools.gallery.pro.fragments.VideoFragment
|
||||
import com.simplemobiletools.gallery.pro.fragments.ViewPagerFragment
|
||||
import com.simplemobiletools.gallery.pro.helpers.*
|
||||
import com.simplemobiletools.gallery.pro.models.Medium
|
||||
|
@ -492,6 +493,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
swipeToNextMedium()
|
||||
}
|
||||
}, mSlideshowInterval * 1000L)
|
||||
} else {
|
||||
(getCurrentFragment() as? VideoFragment)!!.playVideo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.os.Bundle
|
|||
import android.os.Handler
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.*
|
||||
import android.widget.ImageView
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.SeekBar
|
||||
import android.widget.TextView
|
||||
|
@ -52,6 +53,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
|
||||
private var mTextureView: TextureView? = null
|
||||
private var mCurrTimeView: TextView? = null
|
||||
private var mPlayPauseButton: ImageView? = null
|
||||
private var mSeekBar: SeekBar? = null
|
||||
private var mExoPlayer: SimpleExoPlayer? = null
|
||||
private var mVideoSize = Point(0, 0)
|
||||
|
@ -89,6 +91,11 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
}
|
||||
}
|
||||
|
||||
mPlayPauseButton = video_toggle_play_pause
|
||||
mPlayPauseButton!!.setOnClickListener {
|
||||
togglePlayPause()
|
||||
}
|
||||
|
||||
mSeekBar = video_seekbar
|
||||
mSeekBar!!.setOnSeekBarChangeListener(this@VideoFragment)
|
||||
// adding an empty click listener just to avoid ripple animation at toggling fullscreen
|
||||
|
@ -433,6 +440,10 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
}
|
||||
|
||||
mSeekBar!!.setOnSeekBarChangeListener(if (mIsFullscreen) null else this)
|
||||
arrayOf(mView.video_curr_time, mView.video_duration).forEach {
|
||||
it.isClickable = !mIsFullscreen
|
||||
}
|
||||
|
||||
mTimeHolder.animate().alpha(newAlpha).start()
|
||||
mView.video_details.apply {
|
||||
if (mStoredShowExtendedDetails && isVisible()) {
|
||||
|
@ -539,7 +550,12 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
}
|
||||
|
||||
if (!wasEnded || context?.config?.loopVideos == false) {
|
||||
mView.video_play_outline.setImageResource(R.drawable.ic_pause)
|
||||
mPlayPauseButton?.setImageResource(R.drawable.ic_pause_outline)
|
||||
}
|
||||
|
||||
if (!mWasVideoStarted) {
|
||||
mView.video_play_outline.beGone()
|
||||
mPlayPauseButton?.beVisible()
|
||||
}
|
||||
|
||||
mWasVideoStarted = true
|
||||
|
@ -563,7 +579,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
mExoPlayer?.playWhenReady = false
|
||||
}
|
||||
|
||||
mView.video_play_outline?.setImageResource(R.drawable.ic_play)
|
||||
mPlayPauseButton?.setImageResource(R.drawable.ic_play_outline)
|
||||
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue