Filtered apps are now shown like incompatible apps
Apps with antifeatures or root requirements whose settings are not enabled are shown greyed out in searches, direct links and the installed tab. Apks are hidden so as to emphasize that the app should not be installed.
This commit is contained in:
parent
862d7b1183
commit
3ea503f527
@ -377,11 +377,13 @@ public class AppDetails extends ListActivity {
|
||||
private void startViews() {
|
||||
|
||||
// Populate the list...
|
||||
if (!app.filtered) {
|
||||
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
|
||||
@ -504,8 +506,10 @@ public class AppDetails extends ListActivity {
|
||||
private void updateViews() {
|
||||
|
||||
// Refresh the list...
|
||||
if (!app.filtered) {
|
||||
ApkListAdapter la = (ApkListAdapter) getListAdapter();
|
||||
la.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.status);
|
||||
if (app.installedVersion == null)
|
||||
|
@ -190,25 +190,21 @@ public class AppListManager {
|
||||
}
|
||||
|
||||
Date recentDate = calcMaxHistory();
|
||||
AppFilter appFilter = new AppFilter(fdroidActivity);
|
||||
|
||||
List<DB.App> availApps = new ArrayList<DB.App>();
|
||||
for (DB.App app : allApps) {
|
||||
|
||||
boolean isInCategory = isInCategory(app, currentCategory, recentDate);
|
||||
boolean isFiltered = appFilter.filter(app);
|
||||
|
||||
// Add it to the list(s). Always to installed and updates, but
|
||||
// only to available if it's not filtered.
|
||||
if (!isFiltered && isInCategory) {
|
||||
if (showIncompatible || app.compatible) {
|
||||
if (!app.filtered && isInCategory
|
||||
&& (showIncompatible || app.compatible)) {
|
||||
availApps.add(app);
|
||||
}
|
||||
}
|
||||
if (app.installedVersion != null) {
|
||||
installedApps.addItem(app);
|
||||
if (!app.ignoreUpdates && app.hasUpdates &&
|
||||
(showIncompatible || app.compatible))
|
||||
if (!app.ignoreUpdates && app.hasUpdates && !app.filtered
|
||||
&& (showIncompatible || app.compatible))
|
||||
canUpgradeApps.addItem(app);
|
||||
}
|
||||
}
|
||||
|
@ -53,10 +53,12 @@ public class DB {
|
||||
|
||||
private static Semaphore dbSync = new Semaphore(1, true);
|
||||
static DB dbInstance = null;
|
||||
private static Context activityContext = null;
|
||||
|
||||
// Initialise the database. Called once when the application starts up.
|
||||
static void initDB(Context ctx) {
|
||||
dbInstance = new DB(ctx);
|
||||
activityContext = ctx;
|
||||
}
|
||||
|
||||
// Get access to the database. Must be called before any database activity,
|
||||
@ -124,6 +126,7 @@ public class DB {
|
||||
detail_Populated = false;
|
||||
compatible = false;
|
||||
ignoreUpdates = false;
|
||||
filtered = false;
|
||||
}
|
||||
|
||||
// True when all the detail fields are populated, False otherwise.
|
||||
@ -184,6 +187,10 @@ public class DB {
|
||||
// null if there aren't any.
|
||||
public CommaSeparatedList requirements;
|
||||
|
||||
// Whether the app is filtered or not based on AntiFeatures and root
|
||||
// permission (set in the Settings page)
|
||||
public boolean filtered;
|
||||
|
||||
// True if there are new versions (apks) that the user hasn't
|
||||
// explicitly ignored. (We're currently not using the database
|
||||
// field for this - we make the decision on the fly in getApps().
|
||||
@ -751,6 +758,7 @@ public class DB {
|
||||
}
|
||||
|
||||
Map<String, App> apps = new HashMap<String, App>();
|
||||
AppFilter appFilter = new AppFilter(activityContext);
|
||||
Cursor c = null;
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
@ -783,6 +791,7 @@ public class DB {
|
||||
.parse(sLastUpdated);
|
||||
app.compatible = c.getInt(12) == 1;
|
||||
app.ignoreUpdates = c.getInt(13) == 1;
|
||||
app.filtered = appFilter.filter(app);
|
||||
app.hasUpdates = false;
|
||||
|
||||
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
||||
|
@ -95,7 +95,6 @@ public class SearchResults extends ListActivity {
|
||||
}
|
||||
|
||||
List<DB.App> apps = new ArrayList<DB.App>();
|
||||
AppFilter appfilter = new AppFilter(this);
|
||||
List<DB.App> tapps = ((FDroidApp) getApplication()).getApps();
|
||||
for (DB.App tapp : tapps) {
|
||||
boolean include = false;
|
||||
@ -105,7 +104,7 @@ public class SearchResults extends ListActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (include && !appfilter.filter(tapp))
|
||||
if (include)
|
||||
apps.add(tapp);
|
||||
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
||||
// Disable it all if it isn't compatible...
|
||||
View[] views = { convertView, status, summary, license, name };
|
||||
for (View view : views) {
|
||||
view.setEnabled(app.compatible);
|
||||
view.setEnabled(app.compatible && !app.filtered);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
|
Loading…
x
Reference in New Issue
Block a user