Commit 706530ea authored by Sébastien Toque's avatar 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.
parent 4cc7e1d7
......@@ -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() {
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment