fix #886, fade away both play/pause button after a few secs

This commit is contained in:
tibbi 2018-07-30 12:28:42 +02:00
parent 613bbdd214
commit 7b2af9faeb
3 changed files with 14 additions and 8 deletions

View File

@ -47,7 +47,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:4.5.10'
implementation 'com.simplemobiletools:commons:4.5.11'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'it.sephiroth.android.exif:library:1.0.1'

View File

@ -76,9 +76,10 @@ fun SimpleActivity.launchAbout() {
FAQItem(R.string.faq_12_title, R.string.faq_12_text),
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons))
startAboutActivity(R.string.app_name, LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_MULTISELECT or LICENSE_RTL
or LICENSE_SUBSAMPLING or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GIF_DRAWABLE or LICENSE_PHOTOVIEW or LICENSE_EXOPLAYER or
LICENSE_PANORAMA_VIEW or LICENSE_SANSELAN or LICENSE_FILTERS, BuildConfig.VERSION_NAME, faqItems)
val licenses = LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_MULTISELECT or LICENSE_RTL or LICENSE_SUBSAMPLING or LICENSE_PATTERN or
LICENSE_REPRINT or LICENSE_GIF_DRAWABLE or LICENSE_PHOTOVIEW or LICENSE_EXOPLAYER or LICENSE_PANORAMA_VIEW or LICENSE_SANSELAN or LICENSE_FILTERS
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems)
}
fun AppCompatActivity.showSystemUI(toggleActionBarVisibility: Boolean) {

View File

@ -89,7 +89,6 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
}
mIsFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
mView!!.video_play_outline.alpha = if (mIsFullscreen) 0f else PLAY_PAUSE_VISIBLE_ALPHA
setupPlayer()
if (savedInstanceState != null) {
@ -411,9 +410,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
mExoPlayer?.playWhenReady = true
mView!!.video_play_outline.setImageResource(R.drawable.ic_pause)
activity!!.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
mHidePauseHandler.postDelayed({
mView!!.video_play_outline.animate().alpha(0f).start()
}, HIDE_PAUSE_DELAY)
schedulePlayPauseFadeOut()
}
private fun pauseVideo() {
@ -429,6 +426,14 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
mView?.video_play_outline?.setImageResource(R.drawable.ic_play)
mView?.video_play_outline?.alpha = PLAY_PAUSE_VISIBLE_ALPHA
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
schedulePlayPauseFadeOut()
}
private fun schedulePlayPauseFadeOut() {
mHidePauseHandler.removeCallbacksAndMessages(null)
mHidePauseHandler.postDelayed({
mView!!.video_play_outline.animate().alpha(0f).start()
}, HIDE_PAUSE_DELAY)
}
private fun videoEnded() = mExoPlayer?.currentPosition ?: 0 >= mExoPlayer?.duration ?: 0