Use unfiltered application list for updates

This commit is contained in:
Henrik Tunedal 2011-03-28 18:25:23 +02:00
parent c76da4e35f
commit 1ae3e604bd
4 changed files with 11 additions and 9 deletions

View File

@ -270,7 +270,7 @@ public class AppDetails extends ListActivity {
// also when something has been installed/uninstalled. // also when something has been installed/uninstalled.
private void reset() { private void reset() {
Log.d("FDroid", "Getting application details for " + appid); Log.d("FDroid", "Getting application details for " + appid);
app = db.getApps(appid, null, true).get(0); app = db.getApps(appid, null, true, false).get(0);
DB.Apk curver = app.getCurrentVersion(compatChecker); DB.Apk curver = app.getCurrentVersion(compatChecker);
app_currentvercode = curver == null ? 0 : curver.vercode; app_currentvercode = curver == null ? 0 : curver.vercode;

View File

@ -411,7 +411,7 @@ public class DB {
// Get the number of apps that have updates available. // Get the number of apps that have updates available.
public int getNumUpdates() { public int getNumUpdates() {
Vector<App> apps = getApps(null, null, false); Vector<App> apps = getApps(null, null, false, true);
int count = 0; int count = 0;
for (App app : apps) { for (App app : apps) {
if (app.hasUpdates) if (app.hasUpdates)
@ -427,7 +427,9 @@ public class DB {
// 'filter' - search text to filter on, or null // 'filter' - search text to filter on, or null
// 'update' - update installed version information from device, rather than // 'update' - update installed version information from device, rather than
// simply using values cached in the database. Slower. // simply using values cached in the database. Slower.
public Vector<App> getApps(String appid, String filter, boolean update) { // 'exclusions' - apply filtering for compatibility, anti-features, etc.
public Vector<App> getApps(String appid, String filter, boolean update,
boolean exclusions) {
SharedPreferences prefs = PreferenceManager SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(mContext); .getDefaultSharedPreferences(mContext);
@ -460,7 +462,7 @@ public class DB {
app.antiFeatures = DB.CommaSeparatedList.make(c app.antiFeatures = DB.CommaSeparatedList.make(c
.getString(c.getColumnIndex("antiFeatures"))); .getString(c.getColumnIndex("antiFeatures")));
boolean include = true; boolean include = true;
if (app.antiFeatures != null) { if (app.antiFeatures != null && exclusions) {
for (String af : app.antiFeatures) { for (String af : app.antiFeatures) {
if (af.equals("Ads") && !pref_antiAds) if (af.equals("Ads") && !pref_antiAds)
include = false; include = false;
@ -476,7 +478,7 @@ public class DB {
} }
app.requirements = DB.CommaSeparatedList.make(c app.requirements = DB.CommaSeparatedList.make(c
.getString(c.getColumnIndex("requirements"))); .getString(c.getColumnIndex("requirements")));
if (app.requirements != null) { if (app.requirements != null && exclusions) {
for (String r : app.requirements) { for (String r : app.requirements) {
if (r.equals("root") && !pref_rooted) { if (r.equals("root") && !pref_rooted) {
include = false; include = false;
@ -511,7 +513,7 @@ public class DB {
+ " where id = ? order by vercode desc", + " where id = ? order by vercode desc",
new String[] { app.id }); new String[] { app.id });
c2.moveToFirst(); c2.moveToFirst();
boolean compatible = pref_showIncompat; boolean compatible = pref_showIncompat || !exclusions;
while (!c2.isAfterLast()) { while (!c2.isAfterLast()) {
Apk apk = new Apk(); Apk apk = new Apk();
apk.id = app.id; apk.id = app.id;
@ -660,7 +662,7 @@ public class DB {
// end, any that are still false can be removed. // end, any that are still false can be removed.
// TODO: Need to ensure that UI and UpdateService can't both be doing // TODO: Need to ensure that UI and UpdateService can't both be doing
// an update at the same time. // an update at the same time.
updateApps = getApps(null, null, true); updateApps = getApps(null, null, true, false);
Log.d("FDroid", "AppUpdate: " + updateApps.size() Log.d("FDroid", "AppUpdate: " + updateApps.size()
+ " apps before starting."); + " apps before starting.");
// Wrap the whole update in a transaction. Make sure to call // Wrap the whole update in a transaction. Make sure to call

View File

@ -310,7 +310,7 @@ public class FDroid extends TabActivity implements OnItemClickListener {
apps_up.clear(); apps_up.clear();
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
Vector<DB.App> apps = db.getApps(null, null, update); Vector<DB.App> apps = db.getApps(null, null, update, true);
if (apps.isEmpty()) { if (apps.isEmpty()) {
// Don't attempt this more than once - we may have invalid // Don't attempt this more than once - we may have invalid
// repositories. // repositories.

View File

@ -68,7 +68,7 @@ public class SearchResults extends ListActivity {
private void updateView() { private void updateView() {
DB db = new DB(this); DB db = new DB(this);
Vector<DB.App> apps = db.getApps(null, mQuery, false); Vector<DB.App> apps = db.getApps(null, mQuery, false, true);
TextView tv = (TextView) findViewById(R.id.description); TextView tv = (TextView) findViewById(R.id.description);
String headertext; String headertext;
if(apps.size()==0) if(apps.size()==0)