Fix #5708
This commit is contained in:
parent
7c45f6cc68
commit
1a269e802d
1 changed files with 10 additions and 26 deletions
|
@ -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);
|
||||
}
|
||||
} 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;
|
||||
int ic = getIconColorForOutdatedItems(group);
|
||||
if (ic != 0) {
|
||||
return ctx.getMyApplication().getUIUtilities().getIcon(iconId, ic);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item != null) {
|
||||
int color = item.isOutdated() ? R.color.color_distance : R.color.color_ok;
|
||||
return ctx.getMyApplication().getUIUtilities().getIcon(iconId, color);
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue