[Android] VideoPlayerActivity; use SCREEN_ORIENTATION_LOCKED on API 18+

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


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

VideoPlayerActivity; use SCREEN_ORIENTATION_LOCKED on API 18+

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java   |    9 +++++++--
 1 file changed, 7 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 4c06f5d..f67ab7e 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,13 @@ 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) {
+            Log.d(TAG, "getScreenOrientation() = " + getScreenOrientation());
+            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