make Anti-Features list in App Details clickable

This should provide some more info about each anti-feature.
This commit is contained in:
Hans-Christoph Steiner 2018-04-25 17:28:43 +02:00
parent 3a5ecc5e8e
commit e76aa0390d

View File

@ -450,19 +450,24 @@ public class AppDetailsRecyclerViewAdapter
}
}
});
if (app.antiFeatures != null) {
if (app.antiFeatures != null && app.antiFeatures.length > 0) {
StringBuilder sb = new StringBuilder();
sb.append("<ul>");
for (String af : app.antiFeatures) {
String afdesc = descAntiFeature(af);
sb.append("\t• ").append(afdesc).append('\n');
}
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
antiFeaturesView.setText(sb.toString());
} else {
antiFeaturesView.setVisibility(View.GONE);
sb.append("<li><a href=\"https://f-droid.org/wiki/page/Antifeature:")
.append(af)
.append("\">")
.append(afdesc)
.append("</a></li>");
}
sb.append("</ul>");
antiFeaturesView.setText(Html.fromHtml(sb.toString()));
antiFeaturesView.setMovementMethod(LinkMovementMethod.getInstance());
} else {
antiFeaturesView.setVisibility(View.GONE);
}
updateAntiFeaturesWarning();
buttonSecondaryView.setText(R.string.menu_uninstall);
buttonSecondaryView.setVisibility(app.isUninstallable(context) ? View.VISIBLE : View.INVISIBLE);
@ -664,7 +669,8 @@ public class AppDetailsRecyclerViewAdapter
contentView = (LinearLayout) view.findViewById(R.id.ll_content);
}
protected abstract @DrawableRes int getIcon();
@DrawableRes
protected abstract int getIcon();
/**
* Depending on whether we are expanded or not, update the icon which indicates whether the
@ -694,7 +700,8 @@ public class AppDetailsRecyclerViewAdapter
updateExpandableItem(showVersions);
}
protected @DrawableRes int getIcon() {
@DrawableRes
protected int getIcon() {
return R.drawable.ic_access_time_24dp_grey600;
}
}
@ -794,7 +801,8 @@ public class AppDetailsRecyclerViewAdapter
contentView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL));
}
protected @DrawableRes int getIcon() {
@DrawableRes
protected int getIcon() {
return R.drawable.ic_lock_24dp_grey600;
}
}
@ -867,7 +875,8 @@ public class AppDetailsRecyclerViewAdapter
}
}
protected @DrawableRes int getIcon() {
@DrawableRes
protected int getIcon() {
return R.drawable.ic_website;
}
}