[Android] VideoPlayerActivity; use SCREEN_ORIENTATION_LOCKED on API 18+

Edward Wang git at videolan.org
Sun Sep 1 14:06:15 CEST 2013


vlc-ports/android | branch: 0.1.x-bugfix | Edward Wang <edward.c.wang at compdigitec.com> | Sun Sep  1 13:53:52 2013 +0200| [f235138e980b1ab3d0a374e0cf000d88a9ae434b] | committer: Edward Wang

VideoPlayerActivity; use SCREEN_ORIENTATION_LOCKED on API 18+

(cherry picked from commit 078471381204e3c79854cf5cfc5263cddbdb5545)
Signed-off-by: Edward Wang <edward.c.wang at compdigitec.com>

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java    |    8 ++++++--
 1 file changed, 6 insertions(+), 2 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 e03443b..c03b0e2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -574,8 +574,12 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
      * Lock screen rotation
      */
     private void lockScreen() {
-        if(mScreenOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR)
-            setRequestedOrientation(getScreenOrientation());
+        if(mScreenOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) {
+            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
+                setRequestedOrientation(14 /* SCREEN_ORIENTATION_LOCKED */);
+            else
+                setRequestedOrientation(getScreenOrientation());
+        }
         showInfo(R.string.locked, 1000);
         mLock.setBackgroundResource(R.drawable.ic_lock_glow);
         mTime.setEnabled(false);



More information about the Android mailing list