From 717df0b82f3273f945b6468602074b31dc1a6585 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Sun, 16 Sep 2012 11:37:06 +0100 Subject: [PATCH] Adds preference to ignore touchscreen feature A ridiclous number of apps claim to be incompatible with devices that don't have a touchscreen. This even includes devices that have the 'fake touchscreen' feature instead. Nearly all of those have no such requirement, so this preference allows you to ignore it and treat those apps as being compatible. --- res/values/strings.xml | 4 +++- res/xml/preferences.xml | 5 ++++- src/org/fdroid/fdroid/DB.java | 12 +++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 9689a32a9..746e99b0f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -140,7 +140,9 @@ Show apps written for newer Android versions or different hardware Root Show apps that require root privileges - + Ignore Touchscreen + Always include apps that require touchscreen + All What\'s New Recently Updated diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index aa2c7dfa8..51f7c5f67 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -40,7 +40,10 @@ - + + diff --git a/src/org/fdroid/fdroid/DB.java b/src/org/fdroid/fdroid/DB.java index fd84d4919..2f629e015 100644 --- a/src/org/fdroid/fdroid/DB.java +++ b/src/org/fdroid/fdroid/DB.java @@ -307,8 +307,15 @@ public class DB { private static class EclairChecker extends CompatibilityChecker { private HashSet features; + private boolean ignoreTouchscreen; public EclairChecker(Context ctx) { + + SharedPreferences prefs = PreferenceManager + .getDefaultSharedPreferences(ctx); + ignoreTouchscreen = prefs + .getBoolean("ignoreTouchscreen", false); + PackageManager pm = ctx.getPackageManager(); StringBuilder logMsg = new StringBuilder(); logMsg.append("Available device features:"); @@ -326,7 +333,10 @@ public class DB { return false; if (apk.features != null) { for (String feat : apk.features) { - if (!features.contains(feat)) { + if (ignoreTouchscreen + && feat.equals("android.hardware.touchscreen")) { + // Don't check it! + } else if (!features.contains(feat)) { Log.d("FDroid", apk.id + " is incompatible based on lack of " + feat);