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())) {
|
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
|
||||||
iconStart = getIconForDownloadedItems(group, R.drawable.ic_world_globe_dark);
|
iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
|
||||||
if (iconStart == null) {
|
|
||||||
iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
iconStart = getIconForDownloadedItems(group, R.drawable.ic_map);
|
iconStart = getIconForDownloadedItems(group, R.drawable.ic_map);
|
||||||
if (iconStart == null) {
|
if (iconStart == null) {
|
||||||
|
@ -67,46 +64,33 @@ public class DownloadGroupViewHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getIconForDownloadedItems(DownloadResourceGroup group, @DrawableRes int iconId) {
|
private Drawable getIconForDownloadedItems(DownloadResourceGroup group, @DrawableRes int iconId) {
|
||||||
DownloadResourceGroup ggr = group.getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId());
|
int ic = getIconColorForOutdatedItems(group);
|
||||||
if (ggr != null && ggr.getIndividualResources() != null) {
|
if (ic != 0) {
|
||||||
IndexItem item = null;
|
return ctx.getMyApplication().getUIUtilities().getIcon(iconId, ic);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return getIconForOutdatedItems(group, iconId);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getIconForOutdatedItems(DownloadResourceGroup group, @DrawableRes int iconId) {
|
private int getIconColorForOutdatedItems(DownloadResourceGroup group) {
|
||||||
if (group.getIndividualResources() != null) {
|
if (group.getIndividualResources() != null) {
|
||||||
for (IndexItem ii : group.getIndividualResources()) {
|
for (IndexItem ii : group.getIndividualResources()) {
|
||||||
if (ii.getType() == DownloadActivityType.NORMAL_FILE
|
if (ii.getType() == DownloadActivityType.NORMAL_FILE
|
||||||
|| ii.getType() == DownloadActivityType.ROADS_FILE) {
|
|| ii.getType() == DownloadActivityType.ROADS_FILE) {
|
||||||
if (ii.isOutdated()) {
|
if (ii.isOutdated()) {
|
||||||
return ctx.getMyApplication().getUIUtilities().getIcon(iconId, R.color.color_distance);
|
return R.color.color_distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (group.getGroups() != null) {
|
if (group.getGroups() != null) {
|
||||||
for (DownloadResourceGroup g : group.getGroups()) {
|
for (DownloadResourceGroup g : group.getGroups()) {
|
||||||
Drawable d = getIconForOutdatedItems(g, iconId);
|
int d = getIconColorForOutdatedItems(g);
|
||||||
if (d != null) {
|
if (d == R.color.color_distance) {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return R.color.color_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindItem(DownloadResourceGroup group) {
|
public void bindItem(DownloadResourceGroup group) {
|
||||||
|
|
Loading…
Reference in a new issue