From 760957a313bddeda0e846a93e76460cacf892131 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 2 Jan 2019 19:25:30 +0100 Subject: [PATCH] automatically hide system UI at videoplayer activity, if desired --- .../gallery/pro/activities/VideoPlayerActivity.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index a6117563a..d08fa5622 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -163,6 +163,12 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen video_brightness_controller.beGone() video_volume_controller.beGone() } + + if (config.hideSystemUI) { + Handler().postDelayed({ + fullscreenToggled(true) + }, 500) + } } private fun initExoPlayer() { @@ -176,10 +182,11 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen val factory = DataSource.Factory { fileDataSource } val audioSource = ExtractorMediaSource(fileDataSource.uri, factory, DefaultExtractorsFactory(), null, null) - mExoPlayer = ExoPlayerFactory.newSimpleInstance(applicationContext) - mExoPlayer!!.seekParameters = SeekParameters.CLOSEST_SYNC - mExoPlayer!!.audioStreamType = C.STREAM_TYPE_MUSIC - mExoPlayer!!.prepare(audioSource) + mExoPlayer = ExoPlayerFactory.newSimpleInstance(applicationContext).apply { + seekParameters = SeekParameters.CLOSEST_SYNC + audioStreamType = C.STREAM_TYPE_MUSIC + prepare(audioSource) + } initExoPlayerListeners() }