[Android] [PATCH 2/2] Video : Restore the correct orientation in sensor-locked mode

Alexandre Perraud 4leyx4ndre at gmail.com
Tue Oct 21 17:32:47 CEST 2014


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

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 38c1946..a653a3e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -181,6 +181,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
     private boolean mEnableCloneMode;
     private boolean mDisplayRemainingTime = false;
     private int mScreenOrientation;
+    private int mScreenOrientationLock;
     private ImageButton mAudioTrack;
     private ImageButton mSubtitle;
     private ImageButton mLock;
@@ -576,6 +577,9 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
             // Listen for changes to media routes.
             mediaRouterAddCallback(true);
         }
+
+        if (mIsLocked && mScreenOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR)
+            setRequestedOrientation(mScreenOrientationLock);
     }
 
     /**
@@ -818,6 +822,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
                 setRequestedOrientation(14 /* SCREEN_ORIENTATION_LOCKED */);
             else
                 setRequestedOrientation(getScreenOrientation());
+            mScreenOrientationLock = getScreenOrientation();
         }
         showInfo(R.string.locked, 1000);
         mLock.setBackgroundResource(R.drawable.ic_locked);
-- 
2.1.0



More information about the Android mailing list