[Android] don't use SYSTEM_UI_FLAG_HIDE_NAVIGATION on phones without navigation bar
Sébastien Toque
git at videolan.org
Wed Jul 25 22:24:36 CEST 2012
android | branch: master | Sébastien Toque <xilasz at gmail.com> | Wed Jul 25 22:24:22 2012 +0200| [706530ea1bafae475c2ef3582546771aedd53723] | committer: Sébastien Toque
don't use SYSTEM_UI_FLAG_HIDE_NAVIGATION on phones without navigation bar
It's useless, and it might leed the OS to kill the app.
("Channel is unrecoverably broken and will be disposed!")
Unfortunately it seems there's no way to check if a device
use hardware or software buttons, so use a blacklist.
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=706530ea1bafae475c2ef3582546771aedd53723
---
vlc-android/src/org/videolan/vlc/Util.java | 16 ++++++++++++++++
.../videolan/vlc/gui/video/VideoPlayerActivity.java | 2 +-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index bd5ab98..55ee858 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -28,6 +28,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
+import java.util.HashSet;
import java.util.Properties;
import android.content.Context;
@@ -38,8 +39,18 @@ import android.widget.Toast;
public class Util {
public final static String TAG = "VLC/Util";
+ public final static boolean hasNavBar;
/** A set of utility functions for the VLC application */
+ static {
+ HashSet<String> devicesWithoutNavBar = new HashSet<String>();
+ devicesWithoutNavBar.add("HTC One V");
+ devicesWithoutNavBar.add("HTC One S");
+ devicesWithoutNavBar.add("HTC One X");
+ devicesWithoutNavBar.add("HTC One XL");
+ hasNavBar = isICSOrLater() && !devicesWithoutNavBar.contains(android.os.Build.MODEL);
+ }
+
/** Print an on-screen message to alert the user */
public static void toaster(Context context, int stringId, int duration) {
Toast.makeText(context, stringId, duration).show();
@@ -195,6 +206,11 @@ public class Util {
return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
}
+ public static boolean hasNavBar()
+ {
+ return hasNavBar;
+ }
+
private static String errorMsg = null;
private static boolean isCompatible = false;
public static String getErrorMsg() {
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 c661c79..2cddbe9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -922,7 +922,7 @@ public class VideoPlayerActivity extends Activity {
private void dimStatusBar(boolean dim) {
if (Util.isHoneycombOrLater()) {
if (dim) {
- mSurface.setSystemUiVisibility(Util.isICSOrLater()
+ mSurface.setSystemUiVisibility(Util.hasNavBar()
? View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
: View.SYSTEM_UI_FLAG_LOW_PROFILE);
} else {
More information about the Android
mailing list