diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java index f8383b1e90..5c8f035798 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java @@ -228,7 +228,7 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA } ((TextView) row.findViewById(R.id.group_name)).setText(favorite.getCategory()); - icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(activity, favorite.getColor(), 0)); + icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(activity, favorite.getColor(), false)); DashLocationFragment.updateLocationView(!searchAroundLocation, location, heading, direction, distanceText, favorite.getLatitude(), favorite.getLongitude(), screenOrientation, app, activity); diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 048e8f182d..04d5fc23ed 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -807,7 +807,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { } }); } - icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), model.getColor(), 0)); + icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), model.getColor(), false)); LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation(); int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(), lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude())); diff --git a/OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java b/OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java index e965abbb33..5903be75af 100644 --- a/OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java +++ b/OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java @@ -26,7 +26,7 @@ public class FavoriteImageDrawable extends Drawable { private Bitmap favBackground; private Resources resources; - public FavoriteImageDrawable(Context ctx, int color) { + public FavoriteImageDrawable(Context ctx, int color, boolean withShadow) { this.resources = ctx.getResources(); this.color = color; paintIcon = new Paint(); @@ -95,12 +95,12 @@ public class FavoriteImageDrawable extends Drawable { private static TreeMap cache = new TreeMap<>(); - public static FavoriteImageDrawable getOrCreate(Context a, int color, float density) { + public static FavoriteImageDrawable getOrCreate(Context a, int color, boolean withShadow) { color = color | 0xff000000; - int hash = (color << 2) + (int) (density * 6); + int hash = (color << 2) + (withShadow ? 1 : 0); FavoriteImageDrawable drawable = cache.get(hash); if (drawable == null) { - drawable = new FavoriteImageDrawable(a, color); + drawable = new FavoriteImageDrawable(a, color, withShadow); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); cache.put(hash, drawable); } diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java index 2cc93497d1..2b9bee05c1 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java @@ -111,7 +111,7 @@ public class DashFavoritesFragment extends DashLocationFragment { } ((ImageView) view.findViewById(R.id.favourite_icon)).setImageDrawable(FavoriteImageDrawable.getOrCreate( - getActivity(), point.getColor(), 0)); + getActivity(), point.getColor(), false)); DashLocationView dv = new DashLocationView(direction, label, new LatLon(point.getLatitude(), point.getLongitude())); distances.add(dv); diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index c8fdf604c7..9ec641345d 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -683,7 +683,7 @@ public class WaypointHelper { R.drawable.list_intermediate; return uiCtx.getResources().getDrawable(i); } else if(type == FAVORITES || type == WAYPOINTS) { - return FavoriteImageDrawable.getOrCreate(uiCtx, point.getColor(), 0); + return FavoriteImageDrawable.getOrCreate(uiCtx, point.getColor(), false); } else if(type == ALARMS) { //assign alarm list icons manually for now if(((AlarmInfo) point).getType().toString() == "SPEED_CAMERA") { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java index 7a9866d665..c62a37b64d 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java @@ -49,7 +49,7 @@ public class FavouritePointMenuController extends MenuController { @Override public Drawable getLeftIcon() { - return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), fav.getColor(), 0); + return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), fav.getColor(), false); } @Override diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java index c454d173e6..8d2a108b3a 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java @@ -50,7 +50,7 @@ public class WptPtMenuController extends MenuController { @Override public Drawable getLeftIcon() { - return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), wpt.getColor(), 0); + return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), wpt.getColor(), false); } @Override diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java index e01a695bfd..9f425f2fe6 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java @@ -210,7 +210,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment { if (group != null) { color = group.color; } - return FavoriteImageDrawable.getOrCreate(getMapActivity(), color, getMapActivity().getMapView().getCurrentRotatedTileBox().getDensity()); + return FavoriteImageDrawable.getOrCreate(getMapActivity(), color, false); } @Override diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java index 5982b5bccc..4b0b69bacd 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java @@ -459,7 +459,7 @@ public class SelectedGPXFragment extends OsmAndListFragment { if(groupColor == 0) { groupColor = getMyActivity().getResources().getColor(R.color.gpx_track); } - icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getMyActivity(), groupColor, 0)); + icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getMyActivity(), groupColor, false)); } } row.setTag(child); diff --git a/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java b/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java index cf69107014..fc38eb62b4 100644 --- a/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java @@ -90,7 +90,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer. if (this.settings.SHOW_FAVORITES.get()) { if (tileBox.getZoom() >= startZoom) { float iconSize = FavoriteImageDrawable.getOrCreate(view.getContext(), 0, - tileBox.getDensity()).getIntrinsicWidth() * 3 / 2.5f; + true).getIntrinsicWidth() * 3 / 2.5f; QuadTree boundIntersections = initBoundIntersections(tileBox); // request to load @@ -124,7 +124,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer. cache.add(o); int x = (int) tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude()); int y = (int) tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude()); - FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), o.getColor(), tileBox.getDensity()); + FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), o.getColor(), true); fid.drawBitmapInCenter(canvas, x, y); // canvas.drawBitmap(favoriteIcon, x - favoriteIcon.getWidth() / 2, // y - favoriteIcon.getHeight(), paint); diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index a65ee60e2b..e59d4af503 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -277,7 +277,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex int visitedColor = view.getContext().getResources().getColor(R.color.color_ok); if (tileBox.getZoom() >= startZoom) { float iconSize = FavoriteImageDrawable.getOrCreate(view.getContext(), 0, - tileBox.getDensity()).getIntrinsicWidth() * 3 / 2.5f; + true).getIntrinsicWidth() * 3 / 2.5f; QuadTree boundIntersections = initBoundIntersections(tileBox); // request to load @@ -305,8 +305,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex float y = tileBox.getPixYFromLatLon(o.lat, o.lon); boolean visit = isPointVisited(o); int pointColor = visit ? visitedColor : o.getColor(fcolor); - FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), pointColor, - tileBox.getDensity()); + FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), pointColor, true); fid.drawBitmapInCenter(canvas, x, y); } }