[Android] Hide the system bar when playing video on Samsung Dex

Nicolas Pomepuy git at videolan.org
Thu May 11 14:08:00 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu May 11 12:00:26 2023 +0200| [77459469a91578af40aaefe9b45f8efe4adb90d1] | committer: Duncan McNamara

Hide the system bar when playing video on Samsung Dex

Fixes #2930

> https://code.videolan.org/videolan/vlc-android/commit/77459469a91578af40aaefe9b45f8efe4adb90d1
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt      | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index bf42330ce7..3786bb545b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -23,6 +23,7 @@ package org.videolan.vlc.gui.video
 import android.annotation.SuppressLint
 import android.annotation.TargetApi
 import android.app.Activity
+import android.app.ActivityOptions
 import android.app.KeyguardManager
 import android.app.PictureInPictureParams
 import android.bluetooth.BluetoothA2dp
@@ -31,6 +32,7 @@ import android.content.*
 import android.content.pm.ActivityInfo
 import android.content.res.Configuration
 import android.graphics.Bitmap
+import android.graphics.Rect
 import android.media.AudioManager
 import android.net.Uri
 import android.os.*
@@ -62,6 +64,7 @@ import androidx.core.content.getSystemService
 import androidx.core.net.toFile
 import androidx.core.net.toUri
 import androidx.core.view.ViewCompat
+import androidx.core.view.WindowCompat
 import androidx.core.view.WindowInsetsControllerCompat
 import androidx.databinding.BindingAdapter
 import androidx.fragment.app.DialogFragment
@@ -122,6 +125,7 @@ import java.text.SimpleDateFormat
 import java.util.*
 import kotlin.math.roundToInt
 
+
 open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback, PlaylistAdapter.IPlayer, OnClickListener, OnLongClickListener, StoragePermissionsDelegate.CustomActionController, TextWatcher, IDialogManager, KeycodeListener {
 
     var hasPhysicalNotch: Boolean = false
@@ -768,6 +772,12 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
         screenshotDelegate.hide()
     }
 
+    override fun onWindowFocusChanged(hasFocus: Boolean) {
+        if (hasFocus)
+            WindowCompat.getInsetsController(window, window.decorView).systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
+        super.onWindowFocusChanged(hasFocus)
+    }
+
     override fun onStart() {
         medialibrary.pauseBackgroundOperations()
         super.onStart()



More information about the Android mailing list