[Android] Fix notch checkbox not shown after it has been unchecked once

Nicolas Pomepuy git at videolan.org
Thu Apr 7 08:36:02 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Apr  7 07:47:29 2022 +0200| [56f90017f79f70103910802e9f0ed2bb0f1b6b87] | committer: Nicolas Pomepuy

Fix notch checkbox not shown after it has been unchecked once

Fixes #2464

> https://code.videolan.org/videolan/vlc-android/commit/56f90017f79f70103910802e9f0ed2bb0f1b6b87
---

 .../vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt | 4 +++-
 .../src/org/videolan/vlc/gui/video/VideoPlayerResizeDelegate.kt       | 3 +--
 2 files changed, 4 insertions(+), 3 deletions(-)

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 33844278a..d03a8f394 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
@@ -116,6 +116,7 @@ import kotlin.math.roundToInt
 @ExperimentalCoroutinesApi
 open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback, PlaylistAdapter.IPlayer, OnClickListener, OnLongClickListener, StoragePermissionsDelegate.CustomActionController, TextWatcher, IDialogManager, KeycodeListener {
 
+    var hasPhysicalNotch: Boolean = false
     private var subtitlesExtraPath: String? = null
     private lateinit var startedScope: CoroutineScope
     var service: PlaybackService? = null
@@ -493,7 +494,8 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
 
     override fun onAttachedToWindow() {
         super.onAttachedToWindow()
-        if (hasNotch()) {
+        hasPhysicalNotch = hasNotch()
+        if (hasPhysicalNotch) {
             window.attributes.layoutInDisplayCutoutMode = settings.getInt(DISPLAY_UNDER_NOTCH, WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES)
         }
     }
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerResizeDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerResizeDelegate.kt
index 7f7741ed1..27a2244aa 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerResizeDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerResizeDelegate.kt
@@ -46,7 +46,6 @@ import org.videolan.tools.*
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.VideoScaleItemBinding
 import org.videolan.vlc.gui.helpers.enableMarqueeEffect
-import org.videolan.vlc.util.hasNotch
 
 @ObsoleteCoroutinesApi
 @ExperimentalCoroutinesApi
@@ -88,7 +87,7 @@ class VideoPlayerResizeDelegate(private val player: VideoPlayerActivity) {
             }
             sizeList.adapter = sizeAdapter
 
-            if (player.hasNotch()) {
+            if (player.hasPhysicalNotch) {
                 val settings = Settings.getInstance(player)
                 notchCheckbox.setVisible()
                 notchTitle.setVisible()



More information about the Android mailing list