[Android] Fix default orientation when device is held reversed

Nicolas Pomepuy git at videolan.org
Tue Oct 13 14:31:08 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Oct  9 07:43:24 2020 +0200| [ad1afc525d53bc0b4893c9500682daebc8149565] | committer: Nicolas Pomepuy

Fix default orientation when device is held reversed

Fixes #1494

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

 .../vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 e1fff74f06..c5c68fe5f7 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
@@ -401,7 +401,7 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
         val screenOrientationSetting = Integer.valueOf(settings.getString(SCREEN_ORIENTATION, "99" /*SCREEN ORIENTATION SENSOR*/)!!)
         orientationMode = when (screenOrientationSetting) {
             99 -> PlayerOrientationMode(false)
-            101 -> PlayerOrientationMode(true, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
+            101 -> PlayerOrientationMode(true, if (windowManager.defaultDisplay.rotation == Surface.ROTATION_90) ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE else ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE)
             102 -> PlayerOrientationMode(true, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
             else -> PlayerOrientationMode(true, getOrientationForLock())
         }



More information about the Android mailing list