update favorites icon
This commit is contained in:
parent
152414aab1
commit
91b7739581
17 changed files with 205 additions and 25 deletions
|
@ -8,6 +8,7 @@ public class FavouritePoint implements Serializable {
|
|||
private String category = "";
|
||||
private double latitude;
|
||||
private double longitude;
|
||||
private int color;
|
||||
|
||||
|
||||
public FavouritePoint(){
|
||||
|
@ -20,6 +21,14 @@ public class FavouritePoint implements Serializable {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 932 B |
Binary file not shown.
Before Width: | Height: | Size: 763 B |
|
@ -44,7 +44,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical" >
|
||||
android:layout_gravity="center_vertical" >
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -742,7 +742,7 @@
|
|||
<string name="poi_edit_title">Edita el PDI</string>
|
||||
<string name="poi_remove_title">Elimina el PDI</string>
|
||||
<string name="poi_create_title">Crea un PDI</string>
|
||||
<string name="first_time_msg">Gràcies per utilitzar l\'OsmAnd. Per gaudir de més característiques d\'aquesta aplicació necessiteu baixar-vos informació regional fora de línia a través de «Configuració» → «Gestió d'arxius de mapes». Llavors podreu veure mapes, cercar adreces, buscar els PDI i trobar transports públics.</string>
|
||||
<string name="first_time_msg">Gràcies per utilitzar l\'OsmAnd. Per gaudir de més característiques d\'aquesta aplicació necessiteu baixar-vos informació regional fora de línia a través de «Configuració» → «Gestió d\'arxius de mapes». Llavors podreu veure mapes, cercar adreces, buscar els PDI i trobar transports públics.</string>
|
||||
<string name="basemap_was_selected_to_download">Es requereix un mapa base pel correcte funcionament de l\'aplicació i s\'ha seleccionat per baixar-lo.</string>
|
||||
<string name="osmand_background_plugin_description">Mostra els paràmetres per habilitar el seguiment i la navegació en segon pla (pantalla apagada) mitjançant l\'activació periòdica del dispositiu GPS.</string>
|
||||
<string name="accessibility_preferences_descr">Preferències d\'accessibilitat</string>
|
||||
|
@ -1551,7 +1551,7 @@
|
|||
<string name="interrupt_music">Pausa la música</string>
|
||||
<string name="tip_altitude_offset_t">La majoria de dispositius GPS informen les mesures d\'altitud en el sistema de referència WGS84, basat en l\'el·lipsoide, que requereix una correcció depenent de la posició per la conversió a sistemes utilitzats localment.
|
||||
\n\nLa referència EGM96 (geoide) es una aproximació millor a aquests sistemes locals.
|
||||
\n\nOsmAnd indicarà l\'altitud de les teves ubicacions en el sistema EGM96 quan descarreguis el arxiu \'Correcció Mundial d\'Altituds\' (WW15MGH.DAC) mitjançant \'Opcions\' → \'Gestió d'arxius de mapes\'. (L\'original és a http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/binary/WW15MGH.DAC.)
|
||||
\n\nOsmAnd indicarà l\'altitud de les teves ubicacions en el sistema EGM96 quan descarreguis el arxiu \'Correcció Mundial d\'Altituds\' (WW15MGH.DAC) mitjançant \'Opcions\' → \'Gestió d\'arxius de mapes\'. (L\'original és a http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/binary/WW15MGH.DAC.)
|
||||
</string>
|
||||
<string name="osmo_settings_uuid">Identificació única de dispositiu</string>
|
||||
<string name="osmo_settings_descr">Configurar paràmetres de monitorització i fixar el canal de seguiment personal</string>
|
||||
|
@ -1735,8 +1735,8 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
|
|||
* Calcula la ruta entre els punts de la traça GPX
|
||||
* Canviat llistat de països per descarregar (suporta la cerca amb denominacions locals)
|
||||
* Admet importació GPX/KML (conversió de KML a GPX)
|
||||
* Les traces GPX s'han canviat a \'Les meves dades'\
|
||||
* Pots dividir la traça GPX segons distància i comprovar la diferència d'alçada/velocitat
|
||||
* Les traces GPX s\'han canviat a \'Les meves dades\'
|
||||
* Pots dividir la traça GPX segons distància i comprovar la diferència d\'alçada/velocitat
|
||||
* Inici automàtic programable de navegació
|
||||
</string>
|
||||
<string name="osmo_auto_send_locations_descr">Inici automàtic del registre de la traça i del enviament de les posicions tot just iniciar l\'aplicació</string>
|
||||
|
@ -1836,7 +1836,7 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
|
|||
<string name="delay_navigation_start">Iniciar la navegació amb retard</string>
|
||||
<string name="selected">seleccionat</string>
|
||||
<string name="gpx_split_interval">Seleccioni interval de separació</string>
|
||||
<string name="gpx_info_diff_altitude">Diferència d'altitud: %1$s</string>
|
||||
<string name="gpx_info_diff_altitude">Diferència d\'altitud: %1$s</string>
|
||||
<string name="gpx_info_asc_altitude">Desnivell positiu: %1$s</string>
|
||||
<string name="gpx_timespan">Lapse de temps: %1$s</string>
|
||||
<string name="gpx_timemoving">Temps en moviment: %1$s</string>
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
public class GPXUtilities {
|
||||
public final static Log log = PlatformUtil.getLog(GPXUtilities.class);
|
||||
|
@ -55,6 +56,17 @@ public class GPXUtilities {
|
|||
return extensions;
|
||||
}
|
||||
|
||||
public int getColor(int defColor) {
|
||||
if(extensions != null && extensions.containsKey("color")) {
|
||||
try {
|
||||
return Color.parseColor(extensions.get("color").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return defColor;
|
||||
}
|
||||
|
||||
public Map<String, String> getExtensionsToWrite() {
|
||||
if (extensions == null) {
|
||||
extensions = new LinkedHashMap<String, String>();
|
||||
|
@ -79,6 +91,7 @@ public class GPXUtilities {
|
|||
public WptPt() {
|
||||
}
|
||||
|
||||
|
||||
public WptPt(double lat, double lon, long time, double ele, double speed, double hdop) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
|
|
|
@ -89,6 +89,7 @@ public class GpxSelectionHelper {
|
|||
int k = 1;
|
||||
for (Track t : g.tracks) {
|
||||
GpxDisplayGroup group = new GpxDisplayGroup(g);
|
||||
group.color = t.getColor(g.getColor(0));
|
||||
group.setType(GpxDisplayItemType.TRACK_SEGMENT);
|
||||
group.setTrack(t);
|
||||
String ks = (k++) + "";
|
||||
|
@ -407,6 +408,7 @@ public class GpxSelectionHelper {
|
|||
private Track track;
|
||||
private double splitDistance = -1;
|
||||
private int splitTime = -1;
|
||||
private int color;
|
||||
|
||||
public GpxDisplayGroup(GPXFile gpx) {
|
||||
this.gpx = gpx;
|
||||
|
@ -498,6 +500,10 @@ public class GpxSelectionHelper {
|
|||
splitTime = seconds;
|
||||
processGroupTrack(app, this );
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GpxDisplayItem {
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
@ -175,7 +176,7 @@ public class FavouritesListFragment extends SherlockListFragment implements Sear
|
|||
TextView label = (TextView) row.findViewById(R.id.favourite_label);
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
|
||||
final FavouritePoint model = getItem(position);
|
||||
icon.setImageResource(R.drawable.list_favorite);
|
||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(activity, 0));
|
||||
String distance = "";
|
||||
if (location != null) {
|
||||
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(), location.getLatitude(), location
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.osmand.plus.GPXUtilities.WptPt;
|
|||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
@ -437,6 +438,7 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
|
|||
name = p.name.substring(0, c);
|
||||
}
|
||||
FavouritePoint fp = new FavouritePoint(p.lat, p.lon, name, categoryName);
|
||||
fp.setColor(p.getColor(0));
|
||||
if (helper.addFavourite(fp)) {
|
||||
publishProgress(fp);
|
||||
}
|
||||
|
@ -696,7 +698,7 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
|
|||
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
|
||||
final FavouritePoint model = (FavouritePoint) getChild(groupPosition, childPosition);
|
||||
row.setTag(model);
|
||||
icon.setImageResource(R.drawable.list_favorite);
|
||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), 0));
|
||||
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(),
|
||||
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.osmand.plus.OsmAndFormatter;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
@ -411,7 +412,14 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
|||
icon.setImageResource(!lightContent ? R.drawable.ic_action_markers_dark
|
||||
: R.drawable.ic_action_markers_light);
|
||||
} else {
|
||||
icon.setImageResource(R.drawable.list_favorite);
|
||||
int groupColor = child.group.getColor();
|
||||
if(child.locationStart != null) {
|
||||
groupColor = child.locationStart.getColor(groupColor);
|
||||
}
|
||||
if(groupColor == 0) {
|
||||
groupColor = getResources().getColor(R.color.gpx_track);
|
||||
}
|
||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), groupColor));
|
||||
}
|
||||
}
|
||||
row.setTag(child);
|
||||
|
|
136
OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java
Normal file
136
OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java
Normal file
|
@ -0,0 +1,136 @@
|
|||
package net.osmand.plus.base;
|
||||
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
|
||||
public class FavoriteImageDrawable extends Drawable {
|
||||
|
||||
private int color;
|
||||
Paint paintInnerCircle;
|
||||
private Resources resources;
|
||||
private Paint paintOuter;
|
||||
private Drawable drawable;
|
||||
private float density;
|
||||
private Bitmap bmp;
|
||||
private int bmpSize;
|
||||
private Paint paintBmp;
|
||||
|
||||
|
||||
public FavoriteImageDrawable(Context ctx, int color) {
|
||||
this.resources = ctx.getResources();
|
||||
this.color = color;
|
||||
WindowManager mgr = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
mgr.getDefaultDisplay().getMetrics(dm);
|
||||
density = dm.density;
|
||||
drawable = getResources().getDrawable(R.drawable.ic_action_fav_dark);
|
||||
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_fav_dark);
|
||||
bmpSize = bmp.getWidth();
|
||||
paintOuter = new Paint();
|
||||
paintOuter.setColor(0x88555555);
|
||||
paintOuter.setAntiAlias(true);
|
||||
paintOuter.setStyle(Style.FILL_AND_STROKE);
|
||||
paintBmp = new Paint();
|
||||
paintBmp.setAntiAlias(true);
|
||||
paintBmp.setFilterBitmap(true);
|
||||
paintBmp.setDither(true);
|
||||
paintInnerCircle = new Paint();
|
||||
paintInnerCircle.setStyle(Style.FILL_AND_STROKE);
|
||||
paintInnerCircle.setColor(color == 0 ? getResources().getColor(R.color.color_distance) : color);
|
||||
paintInnerCircle.setAntiAlias(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicHeight() {
|
||||
return (int) (drawable.getIntrinsicHeight() + 8 * density);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicWidth() {
|
||||
return (int) (drawable.getIntrinsicWidth() + 8 * density);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public Resources getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onBoundsChange(Rect bounds) {
|
||||
super.onBoundsChange(bounds);
|
||||
Rect bs = new Rect(bounds);
|
||||
bs.inset((int)(4 * density), (int) (4 * density));
|
||||
// int min = Math.min(bounds.width(), bounds.height());
|
||||
// bs.inset((int)(bs.width() - min + 3 * density) / 2,
|
||||
// (int) (bs.height() - min + 3 * density) / 2);
|
||||
drawable.setBounds(bs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
// int max = Math.max(drawable.getMinimumHeight(), drawable.getMinimumWidth());
|
||||
Rect bs = getBounds();
|
||||
int min = Math.min(bs.width(), bs.height());
|
||||
int r = (int) (min / 2);
|
||||
int rs = (int) (min / 2 - 2 * density);
|
||||
canvas.drawCircle(min / 2 , min / 2 + density, r, paintOuter);
|
||||
canvas.drawCircle(min / 2 , min / 2 + density, rs, paintInnerCircle);
|
||||
drawable.draw(canvas);
|
||||
}
|
||||
|
||||
public void drawBitmapInCenter(Canvas canvas, int x, int y) {
|
||||
int min = (int) (bmpSize + 4 * density);
|
||||
int r = (int) (min / 2);
|
||||
int rs = (int) (min / 2 - 2 * density);
|
||||
canvas.drawCircle(x, density + y, r, paintOuter);
|
||||
canvas.drawCircle(x, density + y, rs, paintInnerCircle);
|
||||
canvas.drawBitmap(bmp, x - bmpSize / 2, y - bmpSize / 2 , paintBmp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
paintInnerCircle.setAlpha(alpha);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter cf) {
|
||||
paintInnerCircle.setColorFilter(cf);
|
||||
}
|
||||
|
||||
private static TreeMap<Integer, FavoriteImageDrawable> cache = new TreeMap<Integer, FavoriteImageDrawable>();
|
||||
|
||||
public static FavoriteImageDrawable getOrCreate(Context a, int color) {
|
||||
color = color | 0xff000000;
|
||||
FavoriteImageDrawable drawable = cache.get(color);
|
||||
if(drawable == null) {
|
||||
drawable = new FavoriteImageDrawable(a, color);
|
||||
cache.put(color, drawable);
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -327,7 +327,8 @@ public class GpxImportHelper {
|
|||
|
||||
for (GPXUtilities.WptPt p : wptPts) {
|
||||
if (p.category != null) {
|
||||
favourites.add(new FavouritePoint(p.lat, p.lon, p.name, p.category));
|
||||
final FavouritePoint fp = new FavouritePoint(p.lat, p.lon, p.name, p.category);
|
||||
favourites.add(fp);
|
||||
} else if (p.name != null) {
|
||||
int c;
|
||||
if ((c = p.name.lastIndexOf('_')) != -1) {
|
||||
|
|
|
@ -42,7 +42,7 @@ import android.widget.Toast;
|
|||
public class GpxUiHelper {
|
||||
|
||||
public static String getDescription(OsmandApplication app, GPXFile result, File f, boolean html) {
|
||||
GPXTrackAnalysis analysis = result.getAnalysis(f.lastModified());
|
||||
GPXTrackAnalysis analysis = result.getAnalysis(f == null ? 0 : f.lastModified());
|
||||
return getDescription(app, analysis, html);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ public class OsMoThread {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
log.info("Exception selecting socket", e);
|
||||
cmd("ERROR HEARTBEAT", true);
|
||||
e.printStackTrace();
|
||||
if (activeChannel != null && !activeChannel.isConnected()) {
|
||||
activeChannel = null;
|
||||
|
|
|
@ -12,12 +12,11 @@ import net.osmand.plus.ContextMenuAdapter;
|
|||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
|
@ -30,7 +29,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.I
|
|||
private OsmandMapTileView view;
|
||||
private Paint paint;
|
||||
private FavouritesDbHelper favorites;
|
||||
private Bitmap favoriteIcon;
|
||||
// private Bitmap d;
|
||||
|
||||
|
||||
public FavoritesLayer(){
|
||||
|
@ -47,7 +46,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.I
|
|||
|
||||
favorites = view.getApplication().getFavorites();
|
||||
|
||||
favoriteIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.poi_favourite);
|
||||
// favoriteIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.poi_favourite);
|
||||
|
||||
}
|
||||
|
||||
|
@ -77,12 +76,15 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.I
|
|||
// request to load
|
||||
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||
for (FavouritePoint o : favorites.getFavouritePoints()) {
|
||||
|
||||
if (o.getLatitude() >= latLonBounds.bottom && o.getLatitude() <= latLonBounds.top && o.getLongitude() >= latLonBounds.left
|
||||
&& o.getLongitude() <= latLonBounds.right ) {
|
||||
int x = (int) tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
|
||||
int y = (int) tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
|
||||
canvas.drawBitmap(favoriteIcon, x - favoriteIcon.getWidth() / 2,
|
||||
y - favoriteIcon.getHeight(), paint);
|
||||
FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), o.getColor());
|
||||
fid.drawBitmapInCenter(canvas, x, y);
|
||||
// canvas.drawBitmap(favoriteIcon, x - favoriteIcon.getWidth() / 2,
|
||||
// y - favoriteIcon.getHeight(), paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,9 @@ import net.osmand.plus.GPXUtilities.WptPt;
|
|||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.render.RenderingRuleSearchRequest;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Cap;
|
||||
|
@ -41,7 +40,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
private GpxSelectionHelper selectedGpxHelper;
|
||||
|
||||
private Paint paintBmp;
|
||||
private Bitmap favoriteIcon;
|
||||
// private Drawable favoriteIcon;
|
||||
|
||||
|
||||
private void initUI() {
|
||||
|
@ -58,7 +57,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
paintBmp.setAntiAlias(true);
|
||||
paintBmp.setFilterBitmap(true);
|
||||
paintBmp.setDither(true);
|
||||
favoriteIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.poi_favourite);
|
||||
//favoriteIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.poi_favourite);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,14 +102,16 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||
for (SelectedGpxFile g : selectedGPXFiles) {
|
||||
List<WptPt> pts = g.getGpxFile().points;
|
||||
// int fcolor = g.getColor() == 0 ? clr : g.getColor();
|
||||
int fcolor = g.getColor() == 0 ? clr : g.getColor();
|
||||
FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), fcolor);
|
||||
for (WptPt o : pts) {
|
||||
if (o.lat >= latLonBounds.bottom && o.lat <= latLonBounds.top
|
||||
&& o.lon >= latLonBounds.left && o.lon <= latLonBounds.right) {
|
||||
int x = (int) tileBox.getPixXFromLatLon(o.lat, o.lon);
|
||||
int y = (int) tileBox.getPixYFromLatLon(o.lat, o.lon);
|
||||
canvas.drawBitmap(favoriteIcon, x - favoriteIcon.getWidth() / 2,
|
||||
y - favoriteIcon.getHeight(), paint);
|
||||
fid.drawBitmapInCenter(canvas, x, y);
|
||||
// canvas.drawBitmap(favoriteIcon, x - favoriteIcon.getWidth() / 2,
|
||||
// y - favoriteIcon.getHeight(), paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue