diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DownloadGroupViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/DownloadGroupViewHolder.java index a56d7c2677..2febc9d7f7 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/DownloadGroupViewHolder.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/DownloadGroupViewHolder.java @@ -52,10 +52,7 @@ public class DownloadGroupViewHolder { } } if (isParentWorld(group) || isParentWorld(group.getParentGroup())) { - iconStart = getIconForDownloadedItems(group, R.drawable.ic_world_globe_dark); - if (iconStart == null) { - iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark); - } + iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark); } else { iconStart = getIconForDownloadedItems(group, R.drawable.ic_map); if (iconStart == null) { @@ -67,46 +64,33 @@ public class DownloadGroupViewHolder { } private Drawable getIconForDownloadedItems(DownloadResourceGroup group, @DrawableRes int iconId) { - DownloadResourceGroup ggr = group.getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId()); - if (ggr != null && ggr.getIndividualResources() != null) { - IndexItem item = null; - for (IndexItem ii : ggr.getIndividualResources()) { - if (ii.getType() == DownloadActivityType.NORMAL_FILE - || ii.getType() == DownloadActivityType.ROADS_FILE) { - if (ii.isDownloaded() || ii.isOutdated()) { - item = ii; - break; - } - } - } - if (item != null) { - int color = item.isOutdated() ? R.color.color_distance : R.color.color_ok; - return ctx.getMyApplication().getUIUtilities().getIcon(iconId, color); - } + int ic = getIconColorForOutdatedItems(group); + if (ic != 0) { + return ctx.getMyApplication().getUIUtilities().getIcon(iconId, ic); } - return getIconForOutdatedItems(group, iconId); + return null; } - private Drawable getIconForOutdatedItems(DownloadResourceGroup group, @DrawableRes int iconId) { + private int getIconColorForOutdatedItems(DownloadResourceGroup group) { if (group.getIndividualResources() != null) { for (IndexItem ii : group.getIndividualResources()) { if (ii.getType() == DownloadActivityType.NORMAL_FILE || ii.getType() == DownloadActivityType.ROADS_FILE) { if (ii.isOutdated()) { - return ctx.getMyApplication().getUIUtilities().getIcon(iconId, R.color.color_distance); + return R.color.color_distance; } } } } if (group.getGroups() != null) { for (DownloadResourceGroup g : group.getGroups()) { - Drawable d = getIconForOutdatedItems(g, iconId); - if (d != null) { + int d = getIconColorForOutdatedItems(g); + if (d == R.color.color_distance) { return d; } } } - return null; + return R.color.color_ok; } public void bindItem(DownloadResourceGroup group) {