[Android] Dim the naviguation bar when a video is playing (Android 3.0+)
Ludovic Fauvet
git at videolan.org
Sun Apr 15 23:53:50 CEST 2012
android | branch: master | Ludovic Fauvet <etix at l0cal.com> | Sun Apr 15 23:49:50 2012 +0200| [cd9e5999a5063d9dcda6fb4f5aa84d7eca1c2b88] | committer: Ludovic Fauvet
Dim the naviguation bar when a video is playing (Android 3.0+)
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=cd9e5999a5063d9dcda6fb4f5aa84d7eca1c2b88
---
.../vlc/gui/video/VideoPlayerActivity.java | 24 ++++++++++++++++++++
1 files changed, 24 insertions(+), 0 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 c70efae..d0edae4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -193,6 +193,12 @@ public class VideoPlayerActivity extends Activity {
}
@Override
+ protected void onStart() {
+ super.onStart();
+ dimStatusBar(true);
+ }
+
+ @Override
protected void onPause() {
long time = 0;
if (mLibVLC.isPlaying()) {
@@ -662,6 +668,7 @@ public class VideoPlayerActivity extends Activity {
mShowing = true;
mOverlayHeader.setVisibility(View.VISIBLE);
mOverlay.setVisibility(View.VISIBLE);
+ dimStatusBar(false);
}
Message msg = mHandler.obtainMessage(FADE_OUT);
if (timeout != 0) {
@@ -692,9 +699,26 @@ public class VideoPlayerActivity extends Activity {
mOverlayHeader.setVisibility(View.INVISIBLE);
mOverlay.setVisibility(View.INVISIBLE);
mShowing = false;
+ dimStatusBar(true);
+ }
+ }
+
+ /**
+ * Dim the status bar and/or navigation icons when needed.
+ * Android 3.0 and later
+ */
+ private void dimStatusBar(boolean dim) {
+ if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+ if (dim) {
+ mSurface.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
+ } else {
+ mSurface.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
+ }
}
}
+
+
private void updateOverlayPausePlay() {
if (mLibVLC == null) {
return;
More information about the Android
mailing list