diff --git a/res/values/strings.xml b/res/values/strings.xml
index 317d39568..1d3efa3fd 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -117,8 +117,8 @@
Set the value of SQLite\'s "synchronous" flag
Application compatibility
- Incompatible apps
- Show apps written for newer Android versions or different hardware
+ Incompatible versions
+ Show versions of apps that are incompatible with the device
Root
Show apps that require root privileges
Ignore Touchscreen
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index fb2820414..6dadfa468 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -28,9 +28,9 @@
android:key="compactlayout"/>
-
+
diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java
index 4e06d2355..053ab21c4 100644
--- a/src/org/fdroid/fdroid/AppDetails.java
+++ b/src/org/fdroid/fdroid/AppDetails.java
@@ -232,13 +232,6 @@ public class AppDetails extends ListActivity {
appid = i.getStringExtra("appid");
}
- // Set up the list...
- headerView = new LinearLayout(this);
- ListView lv = (ListView) findViewById(android.R.id.list);
- lv.addHeaderView(headerView);
- ApkListAdapter la = new ApkListAdapter(this, null);
- setListAdapter(la);
-
mPm = getPackageManager();
// Get the preferences we're going to use in this Activity...
AppDetails old = (AppDetails) getLastNonConfigurationInstance();
@@ -252,11 +245,17 @@ public class AppDetails extends ListActivity {
resetRequired = false;
}
+ // Set up the list...
+ headerView = new LinearLayout(this);
+ ListView lv = (ListView) findViewById(android.R.id.list);
+ lv.addHeaderView(headerView);
+ ApkListAdapter la = new ApkListAdapter(this, app.apks);
+ setListAdapter(la);
+
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
pref_expert = prefs.getBoolean("expert", false);
pref_permissions = prefs.getBoolean("showPermissions", false);
- pref_incompatible = prefs.getBoolean("showIncompatible", false);
startViews();
@@ -264,7 +263,6 @@ public class AppDetails extends ListActivity {
private boolean pref_expert;
private boolean pref_permissions;
- private boolean pref_incompatible;
private boolean resetRequired;
// The signature of the installed version.
@@ -391,13 +389,6 @@ public class AppDetails extends ListActivity {
private void startViews() {
- // Populate the list...
- ApkListAdapter la = (ApkListAdapter) getListAdapter();
- for (DB.Apk apk : app.apks)
- if (pref_incompatible || apk.compatible)
- la.addItem(apk);
- la.notifyDataSetChanged();
-
// Insert the 'infoView' (which contains the summary, various odds and
// ends, and the description) into the appropriate place, if we're in
// landscape mode. In portrait mode, we put it in the listview's
diff --git a/src/org/fdroid/fdroid/AppListManager.java b/src/org/fdroid/fdroid/AppListManager.java
index 13f73c259..8e6ca248f 100644
--- a/src/org/fdroid/fdroid/AppListManager.java
+++ b/src/org/fdroid/fdroid/AppListManager.java
@@ -184,9 +184,6 @@ public class AppListManager {
private boolean updateApps() {
allApps = ((FDroidApp)fdroidActivity.getApplication()).getApps();
- SharedPreferences prefs = PreferenceManager
- .getDefaultSharedPreferences(fdroidActivity.getBaseContext());
- boolean showIncompatible = prefs.getBoolean("showIncompatible", false);
if (allApps.isEmpty()) {
// If its the first time we've run the app, this should update
@@ -201,8 +198,7 @@ public class AppListManager {
// Add it to the list(s). Always to installed and updates, but
// only to available if it's not filtered.
- if (!app.filtered && (showIncompatible || app.compatible)
- && isInCategory(app, currentCategory, recentDate)) {
+ if (isInCategory(app, currentCategory, recentDate)) {
availApps.add(app);
}
if (app.installedVersion != null) {
diff --git a/src/org/fdroid/fdroid/DB.java b/src/org/fdroid/fdroid/DB.java
index 85153e07c..3434ec927 100644
--- a/src/org/fdroid/fdroid/DB.java
+++ b/src/org/fdroid/fdroid/DB.java
@@ -819,6 +819,11 @@ public class DB {
Log.d("FDroid", "Read app data from database " + " (took "
+ (System.currentTimeMillis() - startTime) + " ms)");
+ List repos = getRepos();
+ SharedPreferences prefs = PreferenceManager
+ .getDefaultSharedPreferences(mContext);
+ boolean incompatibleVersions = prefs
+ .getBoolean("incompatibleVersions", false);
cols = new String[] { "id", "version", "vercode", "sig", "srcname",
"apkName", "minSdkVersion", "added", "features", "nativecode",
"compatible", "repo" };
@@ -826,22 +831,37 @@ public class DB {
"vercode desc");
c.moveToFirst();
while (!c.isAfterLast()) {
- Apk apk = new Apk();
- apk.id = c.getString(0);
- apk.version = c.getString(1);
- apk.vercode = c.getInt(2);
- apk.sig = c.getString(3);
- apk.srcname = c.getString(4);
- apk.apkName = c.getString(5);
- apk.minSdkVersion = c.getInt(6);
- String sApkAdded = c.getString(7);
- apk.added = (sApkAdded == null || sApkAdded.length() == 0) ? null
- : mDateFormat.parse(sApkAdded);
- apk.features = CommaSeparatedList.make(c.getString(8));
- apk.nativecode = CommaSeparatedList.make(c.getString(9));
- apk.compatible = c.getInt(10) == 1;
- apk.repo = c.getInt(11);
- apps.get(apk.id).apks.add(apk);
+ String id = c.getString(0);
+ App app = apps.get(id);
+ boolean compatible = c.getInt(10) == 1;
+ int repoid = c.getInt(11);
+ if (compatible || incompatibleVersions) {
+ Apk apk = new Apk();
+ apk.id = id;
+ apk.version = c.getString(1);
+ apk.vercode = c.getInt(2);
+ apk.sig = c.getString(3);
+ apk.srcname = c.getString(4);
+ apk.apkName = c.getString(5);
+ apk.minSdkVersion = c.getInt(6);
+ String sApkAdded = c.getString(7);
+ apk.added = (sApkAdded == null || sApkAdded.length() == 0) ? null
+ : mDateFormat.parse(sApkAdded);
+ apk.features = CommaSeparatedList.make(c.getString(8));
+ apk.nativecode = CommaSeparatedList.make(c.getString(9));
+ apk.compatible = compatible;
+ apk.repo = repoid;
+ app.apks.add(apk);
+ }
+ if (app.iconUrl == null && app.icon != null) {
+ for (DB.Repo repo : repos) {
+ if (repo.id == repoid) {
+ app.iconUrl =
+ repo.address + "/icons/" + app.icon;
+ break;
+ }
+ }
+ }
c.moveToNext();
}
c.close();
@@ -1065,12 +1085,10 @@ public class DB {
// Called during update to supply new details for an application (or
// details of a completely new one). Calls to this must be wrapped by
// a call to beginUpdate and a call to endUpdate.
- // Returns true if the app was accepted. If it wasn't, it's probably
- // because it's not compatible with the device.
- public boolean updateApplication(App upapp) {
+ public void updateApplication(App upapp) {
if (updateApps == null) {
- return false;
+ return;
}
// Lazy initialise this...
@@ -1125,7 +1143,6 @@ public class DB {
upapp.updated = true;
updateApps.add(upapp);
}
- return true;
}
diff --git a/src/org/fdroid/fdroid/FDroid.java b/src/org/fdroid/fdroid/FDroid.java
index 7f9259618..19459d6c7 100644
--- a/src/org/fdroid/fdroid/FDroid.java
+++ b/src/org/fdroid/fdroid/FDroid.java
@@ -234,13 +234,18 @@ public class FDroid extends FragmentActivity {
}
break;
case REQUEST_PREFS:
- ((FDroidApp) getApplication()).filterApps();
// The automatic update settings may have changed, so reschedule (or
// unschedule) the service accordingly. It's cheap, so no need to
// check if the particular setting has actually been changed.
UpdateService.schedule(getBaseContext());
- break;
+ if ((resultCode & PreferencesActivity.RESULT_RELOAD) != 0) {
+ ((FDroidApp) getApplication()).invalidateAllApps();
+ } else if ((resultCode & PreferencesActivity.RESULT_REFILTER) != 0) {
+ ((FDroidApp) getApplication()).filterApps();
+ }
+
+ break;
}
}
diff --git a/src/org/fdroid/fdroid/FDroidApp.java b/src/org/fdroid/fdroid/FDroidApp.java
index 72052085d..061a0d280 100644
--- a/src/org/fdroid/fdroid/FDroidApp.java
+++ b/src/org/fdroid/fdroid/FDroidApp.java
@@ -58,7 +58,6 @@ public class FDroidApp extends Application {
// because the install intent says it's finished when it hasn't.
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
- showIncompatible = prefs.getBoolean("showIncompatible", false);
if (!prefs.getBoolean("cacheDownloaded", false)) {
File local_path = DB.getDataPath(this);
@@ -110,8 +109,6 @@ public class FDroidApp extends Application {
// Global list of all known applications.
private List apps;
- private boolean showIncompatible;
-
// Set when something has changed (database or installed apps) so we know
// we should invalidate the apps.
private volatile boolean appsAllInvalid = false;
@@ -161,18 +158,6 @@ public class FDroidApp extends Application {
DB db = DB.getDB();
apps = db.getApps(true);
- List repos = db.getRepos();
- for (DB.App app : apps) {
- if (app.icon == null) continue;
- for (DB.Repo repo : repos) {
- int latestRepo = app.apks.get(0).repo;
- if (repo.id == latestRepo) {
- app.iconUrl = repo.address + "/icons/" + app.icon;
- break;
- }
- }
- }
-
} finally {
DB.releaseDB();
}
@@ -181,19 +166,6 @@ public class FDroidApp extends Application {
DB db = DB.getDB();
apps = db.refreshApps(apps, invalidApps);
- List repos = db.getRepos();
- for (DB.App app : apps) {
- if (app.icon == null) continue;
- if (!invalidApps.contains(app.id)) continue;
- for (DB.Repo repo : repos) {
- int latestRepo = app.apks.get(0).repo;
- if (repo.id == latestRepo) {
- app.iconUrl = repo.address + "/icons/" + app.icon;
- break;
- }
- }
- }
-
invalidApps.clear();
} finally {
DB.releaseDB();
@@ -213,8 +185,7 @@ public class FDroidApp extends Application {
app.toUpdate = (app.hasUpdates
&& !app.ignoreAllUpdates
&& app.curApk.vercode > app.ignoreThisUpdate
- && !app.filtered
- && (showIncompatible || app.compatible));
+ && !app.filtered);
}
}
diff --git a/src/org/fdroid/fdroid/PreferencesActivity.java b/src/org/fdroid/fdroid/PreferencesActivity.java
index 7fc1e6092..59bb1bf1a 100644
--- a/src/org/fdroid/fdroid/PreferencesActivity.java
+++ b/src/org/fdroid/fdroid/PreferencesActivity.java
@@ -18,7 +18,6 @@
package org.fdroid.fdroid;
-import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
@@ -34,21 +33,24 @@ import org.fdroid.fdroid.compat.ActionBarCompat;
public class PreferencesActivity extends PreferenceActivity implements
OnPreferenceChangeListener {
- Intent ret;
+ public static final int RESULT_RELOAD = 1;
+ public static final int RESULT_REFILTER = 2;
+ private int result = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
addPreferencesFromResource(R.xml.preferences);
- for (String prefkey : new String[] { "updateInterval" }) {
- Preference pref = findPreference(prefkey);
- pref.setOnPreferenceChangeListener(this);
- CheckBoxPreference onlyOnWifi = (CheckBoxPreference)
- findPreference("updateOnWifiOnly");
- onlyOnWifi.setEnabled(Integer.parseInt(
- ((ListPreference)pref).getValue()) > 0);
+ for (String prefkey : new String[] {
+ "updateInterval", "rooted", "incompatibleVersions" }) {
+ findPreference(prefkey).setOnPreferenceChangeListener(this);
}
+ CheckBoxPreference onlyOnWifi = (CheckBoxPreference)
+ findPreference("updateOnWifiOnly");
+ onlyOnWifi.setEnabled(Integer.parseInt(
+ ((ListPreference)findPreference("updateInterval"))
+ .getValue()) > 0);
}
@Override
@@ -71,6 +73,16 @@ public class PreferencesActivity extends PreferenceActivity implements
onlyOnWifi.setEnabled(interval > 0);
return true;
}
+ if (key.equals("incompatibleVersions")) {
+ result ^= RESULT_RELOAD;
+ setResult(result);
+ return true;
+ }
+ if (key.equals("rooted")) {
+ result ^= RESULT_REFILTER;
+ setResult(result);
+ return true;
+ }
return false;
}