Fixed skipping painting of prepainted icons.

This commit is contained in:
GaidamakUA 2016-04-29 10:43:40 +03:00
parent 89a8357cfc
commit 59ae489ed9
3 changed files with 8 additions and 4 deletions

View file

@ -182,10 +182,10 @@ public class ContextMenuAdapter {
} else {
if (item.getIcon() != ContextMenuItem.INVALID_ID) {
int colorRes = item.getColorRes();
if (colorRes == ContextMenuItem.INVALID_ID) {
if (colorRes == ContextMenuItem.INVALID_ID && !item.shouldSkipPainting()) {
colorRes = lightTheme ? R.color.icon_color : R.color.color_white;
}
Drawable drawable = mIconsCache.getIcon(item.getIcon(), colorRes);
final Drawable drawable = mIconsCache.getIcon(item.getIcon(), colorRes);
((AppCompatImageView) convertView.findViewById(R.id.icon)).setImageDrawable(drawable);
convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE);
} else if (convertView.findViewById(R.id.icon) != null) {

View file

@ -142,6 +142,10 @@ public class ContextMenuItem {
return integerListener;
}
public boolean shouldSkipPainting() {
return skipPaintingWithoutColor;
}
public boolean shouldHideDivider() {
return hideDivider;
}

View file

@ -54,7 +54,6 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
/**
* Object is responsible to maintain layers using by map activity
@ -322,7 +321,8 @@ public class MapActivityLayers {
} else {
builder.setIcon(R.drawable.mx_user_defined);
}
builder.setColor(R.color.osmand_orange);
builder.setColor(ContextMenuItem.INVALID_ID);
builder.setSkipPaintingWithoutColor(true);
adapter.addItem(builder.createItem());
}