[Android] Fix lock not restoring video orientation

Geoffrey Métais git at videolan.org
Tue Mar 22 13:25:00 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 22 11:56:33 2016 +0100| [59c48edbd622a7a553147ba7bc7f6a39de0d6eaf] | committer: Geoffrey Métais

Fix lock not restoring video orientation

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java  | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 2a00a0d..2a329b9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -402,7 +402,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mVerticalBarProgress = findViewById(R.id.verticalbar_progress);
 
         mScreenOrientation = Integer.valueOf(
-                mSettings.getString("screen_orientation_value", "99" /*SCREEN ORIENTATION USER*/));
+                mSettings.getString("screen_orientation_value", "99" /*SCREEN ORIENTATION SENSOR*/));
 
         mPlayPause = (ImageView) findViewById(R.id.player_overlay_play);
 
@@ -1298,12 +1298,12 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      * Lock screen rotation
      */
     private void lockScreen() {
-        if(mScreenOrientation == 99) {
+        if(mScreenOrientation != 100) {
+            mScreenOrientationLock = getRequestedOrientation();
             if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
                 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
             else
                 setRequestedOrientation(getScreenOrientation(100));
-            mScreenOrientationLock = getScreenOrientation(mScreenOrientation);
         }
         showInfo(R.string.locked, 1000);
         mLock.setImageResource(R.drawable.ic_locked_circle);
@@ -1320,10 +1320,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      * Remove screen lock
      */
     private void unlockScreen() {
-        if(mScreenOrientation == 99)
-            setRequestedOrientation(AndroidUtil.isJellyBeanMR2OrLater() ?
-                    ActivityInfo.SCREEN_ORIENTATION_FULL_USER :
-                    ActivityInfo.SCREEN_ORIENTATION_USER);
+        if(mScreenOrientation != 100)
+            setRequestedOrientation(mScreenOrientationLock);
         showInfo(R.string.unlocked, 1000);
         mLock.setImageResource(R.drawable.ic_lock_circle);
         mTime.setEnabled(true);



More information about the Android mailing list