Handle unrecognises antifeatures more gracefully

This allows us to add new ones without making a mess in the client.
Prior to this change it would add empty lines, and also if the only
antifeature was an unrecognised one, would enable the antifeature view
box but with nothing in it. It should now ignore them completely.
This commit is contained in:
Ciaran Gultnieks 2013-11-17 11:33:05 +00:00
parent 4f717c663b
commit 1b8ea8f3d5

View File

@ -534,10 +534,18 @@ public class AppDetails extends ListActivity {
tv = (TextView) infoView.findViewById(R.id.antifeatures);
if (app.antiFeatures != null) {
StringBuilder sb = new StringBuilder();
for (String af : app.antiFeatures)
sb.append("\t• " + descAntiFeature(af) + "\n");
if (sb.length() > 0) sb.setLength(sb.length() - 1);
tv.setText(sb.toString());
for (String af : app.antiFeatures) {
String afdesc = descAntiFeature(af);
if (afdesc != null) {
sb.append("\t• " + afdesc + "\n");
}
}
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
tv.setText(sb.toString());
} else {
tv.setVisibility(View.GONE);
}
} else {
tv.setVisibility(View.GONE);
}
@ -554,7 +562,7 @@ public class AppDetails extends ListActivity {
return getString(R.string.antinonfreeadlist);
if (af.equals("NonFreeDep"))
return getString(R.string.antinonfreedeplist);
return "";
return null;
}
private void updateViews() {