Filtering bools are now done once per refresh
This commit is contained in:
parent
3ea503f527
commit
40f4482bd6
@ -53,12 +53,10 @@ public class DB {
|
|||||||
|
|
||||||
private static Semaphore dbSync = new Semaphore(1, true);
|
private static Semaphore dbSync = new Semaphore(1, true);
|
||||||
static DB dbInstance = null;
|
static DB dbInstance = null;
|
||||||
private static Context activityContext = null;
|
|
||||||
|
|
||||||
// Initialise the database. Called once when the application starts up.
|
// Initialise the database. Called once when the application starts up.
|
||||||
static void initDB(Context ctx) {
|
static void initDB(Context ctx) {
|
||||||
dbInstance = new DB(ctx);
|
dbInstance = new DB(ctx);
|
||||||
activityContext = ctx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get access to the database. Must be called before any database activity,
|
// Get access to the database. Must be called before any database activity,
|
||||||
@ -758,7 +756,6 @@ public class DB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, App> apps = new HashMap<String, App>();
|
Map<String, App> apps = new HashMap<String, App>();
|
||||||
AppFilter appFilter = new AppFilter(activityContext);
|
|
||||||
Cursor c = null;
|
Cursor c = null;
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
@ -791,7 +788,6 @@ public class DB {
|
|||||||
.parse(sLastUpdated);
|
.parse(sLastUpdated);
|
||||||
app.compatible = c.getInt(12) == 1;
|
app.compatible = c.getInt(12) == 1;
|
||||||
app.ignoreUpdates = c.getInt(13) == 1;
|
app.ignoreUpdates = c.getInt(13) == 1;
|
||||||
app.filtered = appFilter.filter(app);
|
|
||||||
app.hasUpdates = false;
|
app.hasUpdates = false;
|
||||||
|
|
||||||
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
||||||
|
@ -236,6 +236,7 @@ public class FDroid extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REQUEST_PREFS:
|
case REQUEST_PREFS:
|
||||||
|
((FDroidApp) getApplication()).filterApps();
|
||||||
// The automatic update settings may have changed, so reschedule (or
|
// The automatic update settings may have changed, so reschedule (or
|
||||||
// unschedule) the service accordingly. It's cheap, so no need to
|
// unschedule) the service accordingly. It's cheap, so no need to
|
||||||
// check if the particular setting has actually been changed.
|
// check if the particular setting has actually been changed.
|
||||||
|
@ -66,12 +66,14 @@ public class FDroidApp extends Application {
|
|||||||
|
|
||||||
apps = null;
|
apps = null;
|
||||||
invalidApps = new ArrayList<String>();
|
invalidApps = new ArrayList<String>();
|
||||||
Context ctx = getApplicationContext();
|
ctx = getApplicationContext();
|
||||||
DB.initDB(ctx);
|
DB.initDB(ctx);
|
||||||
UpdateService.schedule(ctx);
|
UpdateService.schedule(ctx);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Context ctx;
|
||||||
|
|
||||||
// Global list of all known applications.
|
// Global list of all known applications.
|
||||||
private List<DB.App> apps;
|
private List<DB.App> apps;
|
||||||
|
|
||||||
@ -137,7 +139,15 @@ public class FDroidApp extends Application {
|
|||||||
}
|
}
|
||||||
if (apps == null)
|
if (apps == null)
|
||||||
return new ArrayList<DB.App>();
|
return new ArrayList<DB.App>();
|
||||||
|
filterApps();
|
||||||
return apps;
|
return apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void filterApps() {
|
||||||
|
AppFilter appFilter = new AppFilter(ctx);
|
||||||
|
for (DB.App app : apps) {
|
||||||
|
app.filtered = appFilter.filter(app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user