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 { } else {
if (item.getIcon() != ContextMenuItem.INVALID_ID) { if (item.getIcon() != ContextMenuItem.INVALID_ID) {
int colorRes = item.getColorRes(); 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; 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); ((AppCompatImageView) convertView.findViewById(R.id.icon)).setImageDrawable(drawable);
convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE); convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE);
} else if (convertView.findViewById(R.id.icon) != null) { } else if (convertView.findViewById(R.id.icon) != null) {

View file

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

View file

@ -54,7 +54,6 @@ import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
/** /**
* Object is responsible to maintain layers using by map activity * Object is responsible to maintain layers using by map activity
@ -322,7 +321,8 @@ public class MapActivityLayers {
} else { } else {
builder.setIcon(R.drawable.mx_user_defined); 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()); adapter.addItem(builder.createItem());
} }