New target point icon
This commit is contained in:
parent
eca63fa59b
commit
b1fafddb3a
4 changed files with 13 additions and 5 deletions
BIN
OsmAnd/res/drawable-hdpi/target_point.png
Normal file
BIN
OsmAnd/res/drawable-hdpi/target_point.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
BIN
OsmAnd/res/drawable/target_point.png
Normal file
BIN
OsmAnd/res/drawable/target_point.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
|
@ -371,7 +371,6 @@ public class ResourceManager {
|
||||||
File file = context.getSettings().extendOsmandPath(APP_DIR);
|
File file = context.getSettings().extendOsmandPath(APP_DIR);
|
||||||
file.mkdirs();
|
file.mkdirs();
|
||||||
if(file.canWrite()){
|
if(file.canWrite()){
|
||||||
// TODO delete
|
|
||||||
if(!Version.APP_VERSION.equalsIgnoreCase(context.getSettings().PREVIOUS_INSTALLED_VERSION.get())){
|
if(!Version.APP_VERSION.equalsIgnoreCase(context.getSettings().PREVIOUS_INSTALLED_VERSION.get())){
|
||||||
try {
|
try {
|
||||||
progress.startTask(context.getString(R.string.installing_new_resources), -1);
|
progress.startTask(context.getString(R.string.installing_new_resources), -1);
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.views;
|
||||||
|
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
|
import net.osmand.plus.R;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
|
@ -10,6 +13,7 @@ import android.graphics.Path;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
@ -25,15 +29,16 @@ public class PointNavigationLayer implements OsmandMapLayer {
|
||||||
private Path pathForDirection;
|
private Path pathForDirection;
|
||||||
private float[] calculations = new float[2];
|
private float[] calculations = new float[2];
|
||||||
private DisplayMetrics dm;
|
private DisplayMetrics dm;
|
||||||
|
private Bitmap targetPoint;
|
||||||
|
|
||||||
|
|
||||||
private void initUI() {
|
private void initUI() {
|
||||||
point = new Paint();
|
point = new Paint();
|
||||||
point.setColor(Color.rgb(250, 80, 80));
|
|
||||||
point.setAntiAlias(true);
|
point.setAntiAlias(true);
|
||||||
point.setStyle(Style.FILL);
|
targetPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.target_point);
|
||||||
|
|
||||||
pathForDirection = new Path();
|
pathForDirection = new Path();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initLayer(OsmandMapTileView view) {
|
public void initLayer(OsmandMapTileView view) {
|
||||||
|
@ -52,10 +57,14 @@ public class PointNavigationLayer implements OsmandMapLayer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isLocationVisible()) {
|
if (isLocationVisible()) {
|
||||||
|
int marginX = targetPoint.getWidth() / 3;
|
||||||
|
int marginY = 2 * targetPoint.getHeight() / 3;
|
||||||
int locationX = view.getMapXForPoint(pointToNavigate.getLongitude());
|
int locationX = view.getMapXForPoint(pointToNavigate.getLongitude());
|
||||||
int locationY = view.getMapYForPoint(pointToNavigate.getLatitude());
|
int locationY = view.getMapYForPoint(pointToNavigate.getLatitude());
|
||||||
|
canvas.rotate(-view.getRotate(), locationX, locationY);
|
||||||
canvas.drawCircle(locationX, locationY, RADIUS * dm.density, point);
|
Drawable drawable = view.getResources().getDrawable(R.drawable.target_point);
|
||||||
|
drawable.draw(canvas);
|
||||||
|
canvas.drawBitmap(targetPoint, locationX - marginX, locationY - marginY, point);
|
||||||
} else {
|
} else {
|
||||||
Location.distanceBetween(view.getLatitude(), view.getLongitude(), pointToNavigate.getLatitude(),
|
Location.distanceBetween(view.getLatitude(), view.getLongitude(), pointToNavigate.getLatitude(),
|
||||||
pointToNavigate.getLongitude(), calculations);
|
pointToNavigate.getLongitude(), calculations);
|
||||||
|
|
Loading…
Reference in a new issue