show "Anti-features" in list view when app is filtered

closes fdroid/fdroidclient#1533
This commit is contained in:
Hans-Christoph Steiner 2018-07-30 15:46:58 +02:00
parent 90acd75b90
commit fe37695751

View File

@ -4,7 +4,6 @@ import android.app.Activity;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import org.fdroid.fdroid.AppUpdateStatusManager;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.data.App;
@ -12,9 +11,11 @@ import org.fdroid.fdroid.data.App;
/**
* Used for search results or for category lists.
* Shows an inline download button, and also (if appropriate):
* * Whether the app is incompatible.
* * Version that app can be upgraded to.
* * Installed version.
* <ul>
* <li>Whether the app is incompatible
* <li>Version that app can be upgraded to
* <li>Installed version
* </ul>
*/
public class StandardAppListItemController extends AppListItemController {
public StandardAppListItemController(Activity activity, View itemView) {
@ -35,6 +36,8 @@ public class StandardAppListItemController extends AppListItemController {
private CharSequence getStatusText(@NonNull App app) {
if (!app.compatible) {
return activity.getString(R.string.app_incompatible);
} else if (app.isDisabledByAntiFeatures()) {
return activity.getString(R.string.antifeatures);
} else if (app.isInstalled(activity.getApplicationContext())) {
if (app.canAndWantToUpdate(activity)) {
return activity.getString(R.string.app_version_x_available, app.getSuggestedVersionName());