Correct handling of localized metadata representing images.
Previously, it assumed that featureGraphic et al. were always present if the localised entry was present. This is not the case, so we only return a URL if we can actually find the entry we are looking for.
This commit is contained in:
parent
3d7a4ef8dc
commit
854b19eee6
@ -432,8 +432,12 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
Set<String> locales, String key) {
|
||||
try {
|
||||
for (String locale : locales) {
|
||||
if (localized.containsKey(locale)) {
|
||||
return locale + "/" + localized.get(locale).get(key);
|
||||
Map<String, Object> entry = localized.get(locale);
|
||||
if (entry != null) {
|
||||
Object value = entry.get(key);
|
||||
if (value != null && value.toString().length() > 0) {
|
||||
return locale + "/" + value;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
|
@ -254,6 +254,7 @@ public class FeatureImage extends AppCompatImageView {
|
||||
}
|
||||
|
||||
public void loadImageAndDisplay(@NonNull ImageLoader loader, @NonNull DisplayImageOptions imageOptions, @Nullable String featureImageToShow, @Nullable String fallbackImageToExtractColours) {
|
||||
setColour(ContextCompat.getColor(getContext(), R.color.fdroid_blue));
|
||||
if (!TextUtils.isEmpty(featureImageToShow)) {
|
||||
loadImageAndDisplay(loader, imageOptions, featureImageToShow);
|
||||
} else if (!TextUtils.isEmpty(fallbackImageToExtractColours)) {
|
||||
|
@ -94,7 +94,7 @@ public class CategoryController extends RecyclerView.ViewHolder implements Loade
|
||||
image.setColour(backgroundColour);
|
||||
image.setImageDrawable(null);
|
||||
} else {
|
||||
image.setColour(0);
|
||||
image.setColour(ContextCompat.getColor(activity, R.color.fdroid_blue));
|
||||
ImageLoader.getInstance().displayImage("drawable://" + categoryImageId, image, displayImageOptions);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user