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() {
|
private void startViews() {
|
||||||
|
|
||||||
// Populate the list...
|
// Populate the list...
|
||||||
ApkListAdapter la = (ApkListAdapter) getListAdapter();
|
if (!app.filtered) {
|
||||||
for (DB.Apk apk : app.apks)
|
ApkListAdapter la = (ApkListAdapter) getListAdapter();
|
||||||
if (pref_incompatible || apk.compatible)
|
for (DB.Apk apk : app.apks)
|
||||||
la.addItem(apk);
|
if (pref_incompatible || apk.compatible)
|
||||||
la.notifyDataSetChanged();
|
la.addItem(apk);
|
||||||
|
la.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
// Insert the 'infoView' (which contains the summary, various odds and
|
// Insert the 'infoView' (which contains the summary, various odds and
|
||||||
// ends, and the description) into the appropriate place, if we're in
|
// ends, and the description) into the appropriate place, if we're in
|
||||||
@ -504,8 +506,10 @@ public class AppDetails extends ListActivity {
|
|||||||
private void updateViews() {
|
private void updateViews() {
|
||||||
|
|
||||||
// Refresh the list...
|
// Refresh the list...
|
||||||
ApkListAdapter la = (ApkListAdapter) getListAdapter();
|
if (!app.filtered) {
|
||||||
la.notifyDataSetChanged();
|
ApkListAdapter la = (ApkListAdapter) getListAdapter();
|
||||||
|
la.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
TextView tv = (TextView) findViewById(R.id.status);
|
TextView tv = (TextView) findViewById(R.id.status);
|
||||||
if (app.installedVersion == null)
|
if (app.installedVersion == null)
|
||||||
|
@ -190,25 +190,21 @@ public class AppListManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Date recentDate = calcMaxHistory();
|
Date recentDate = calcMaxHistory();
|
||||||
AppFilter appFilter = new AppFilter(fdroidActivity);
|
|
||||||
|
|
||||||
List<DB.App> availApps = new ArrayList<DB.App>();
|
List<DB.App> availApps = new ArrayList<DB.App>();
|
||||||
for (DB.App app : allApps) {
|
for (DB.App app : allApps) {
|
||||||
|
|
||||||
boolean isInCategory = isInCategory(app, currentCategory, recentDate);
|
boolean isInCategory = isInCategory(app, currentCategory, recentDate);
|
||||||
boolean isFiltered = appFilter.filter(app);
|
|
||||||
|
|
||||||
// Add it to the list(s). Always to installed and updates, but
|
// Add it to the list(s). Always to installed and updates, but
|
||||||
// only to available if it's not filtered.
|
// only to available if it's not filtered.
|
||||||
if (!isFiltered && isInCategory) {
|
if (!app.filtered && isInCategory
|
||||||
if (showIncompatible || app.compatible) {
|
&& (showIncompatible || app.compatible)) {
|
||||||
availApps.add(app);
|
availApps.add(app);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (app.installedVersion != null) {
|
if (app.installedVersion != null) {
|
||||||
installedApps.addItem(app);
|
installedApps.addItem(app);
|
||||||
if (!app.ignoreUpdates && app.hasUpdates &&
|
if (!app.ignoreUpdates && app.hasUpdates && !app.filtered
|
||||||
(showIncompatible || app.compatible))
|
&& (showIncompatible || app.compatible))
|
||||||
canUpgradeApps.addItem(app);
|
canUpgradeApps.addItem(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,12 @@ 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,
|
||||||
@ -124,6 +126,7 @@ public class DB {
|
|||||||
detail_Populated = false;
|
detail_Populated = false;
|
||||||
compatible = false;
|
compatible = false;
|
||||||
ignoreUpdates = false;
|
ignoreUpdates = false;
|
||||||
|
filtered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// True when all the detail fields are populated, False otherwise.
|
// True when all the detail fields are populated, False otherwise.
|
||||||
@ -184,6 +187,10 @@ public class DB {
|
|||||||
// null if there aren't any.
|
// null if there aren't any.
|
||||||
public CommaSeparatedList requirements;
|
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
|
// True if there are new versions (apks) that the user hasn't
|
||||||
// explicitly ignored. (We're currently not using the database
|
// explicitly ignored. (We're currently not using the database
|
||||||
// field for this - we make the decision on the fly in getApps().
|
// 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>();
|
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 {
|
||||||
@ -783,6 +791,7 @@ 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)) {
|
||||||
|
@ -95,7 +95,6 @@ public class SearchResults extends ListActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DB.App> apps = new ArrayList<DB.App>();
|
List<DB.App> apps = new ArrayList<DB.App>();
|
||||||
AppFilter appfilter = new AppFilter(this);
|
|
||||||
List<DB.App> tapps = ((FDroidApp) getApplication()).getApps();
|
List<DB.App> tapps = ((FDroidApp) getApplication()).getApps();
|
||||||
for (DB.App tapp : tapps) {
|
for (DB.App tapp : tapps) {
|
||||||
boolean include = false;
|
boolean include = false;
|
||||||
@ -105,7 +104,7 @@ public class SearchResults extends ListActivity {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (include && !appfilter.filter(tapp))
|
if (include)
|
||||||
apps.add(tapp);
|
apps.add(tapp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
// Disable it all if it isn't compatible...
|
// Disable it all if it isn't compatible...
|
||||||
View[] views = { convertView, status, summary, license, name };
|
View[] views = { convertView, status, summary, license, name };
|
||||||
for (View view : views) {
|
for (View view : views) {
|
||||||
view.setEnabled(app.compatible);
|
view.setEnabled(app.compatible && !app.filtered);
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user