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

Alexandre Perraud git at videolan.org
Tue Oct 21 17:44:12 CEST 2014


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Tue Oct 21 17:32:47 2014 +0200| [08936b8384b812504261019b16c1d74e9aae903f] | committer: Jean-Baptiste Kempf

Video : Restore the correct orientation in sensor-locked mode

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=08936b8384b812504261019b16c1d74e9aae903f
---

 .../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);



More information about the Android mailing list