[Android] VideoPlayerActivity; use SCREEN_ORIENTATION_LOCKED on API 18+

Edward Wang git at videolan.org
Sun Sep 1 14:02:19 CEST 2013


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

VideoPlayerActivity; use SCREEN_ORIENTATION_LOCKED on API 18+

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

 .../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 419e68b..fa91ade 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -573,8 +573,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