Fix #3421
This commit is contained in:
parent
07a5b6994e
commit
c0d362d424
2 changed files with 33 additions and 15 deletions
|
@ -119,6 +119,8 @@ public class ApplicationMode {
|
|||
public ApplicationModeBuilder carLocation() {
|
||||
applicationMode.bearingIconDay = R.drawable.map_car_bearing;
|
||||
applicationMode.bearingIconNight = R.drawable.map_car_bearing_night;
|
||||
applicationMode.headingIconDay = R.drawable.map_car_location_view_angle;
|
||||
applicationMode.headingIconNight = R.drawable.map_car_location_view_angle_night;
|
||||
applicationMode.locationIconDay = R.drawable.map_car_location;
|
||||
applicationMode.locationIconNight = R.drawable.map_car_location_night;
|
||||
return this;
|
||||
|
@ -132,6 +134,8 @@ public class ApplicationMode {
|
|||
public ApplicationModeBuilder bicycleLocation() {
|
||||
applicationMode.bearingIconDay = R.drawable.map_bicycle_bearing;
|
||||
applicationMode.bearingIconNight = R.drawable.map_bicycle_bearing_night;
|
||||
applicationMode.headingIconDay = R.drawable.map_bicycle_location_view_angle;
|
||||
applicationMode.headingIconNight = R.drawable.map_bicycle_location_view_angle_night;
|
||||
applicationMode.locationIconDay = R.drawable.map_bicycle_location;
|
||||
applicationMode.locationIconNight = R.drawable.map_bicycle_location_night;
|
||||
return this;
|
||||
|
@ -140,6 +144,8 @@ public class ApplicationMode {
|
|||
public ApplicationModeBuilder defLocation() {
|
||||
applicationMode.bearingIconDay = R.drawable.map_pedestrian_bearing;
|
||||
applicationMode.bearingIconNight = R.drawable.map_pedestrian_bearing_night;
|
||||
applicationMode.headingIconDay = R.drawable.map_default_location_view_angle;
|
||||
applicationMode.headingIconNight = R.drawable.map_default_location_view_angle_night;
|
||||
applicationMode.locationIconDay = R.drawable.map_pedestrian_location;
|
||||
applicationMode.locationIconNight = R.drawable.map_pedestrian_location_night;
|
||||
return this;
|
||||
|
@ -281,6 +287,14 @@ public class ApplicationMode {
|
|||
return bearingIconNight;
|
||||
}
|
||||
|
||||
public int getResourceHeadingDay() {
|
||||
return headingIconDay;
|
||||
}
|
||||
|
||||
public int getResourceHeadingNight() {
|
||||
return headingIconNight;
|
||||
}
|
||||
|
||||
public int getResourceLocationDay() {
|
||||
return locationIconDay;
|
||||
}
|
||||
|
@ -339,13 +353,15 @@ public class ApplicationMode {
|
|||
private final String stringKey;
|
||||
|
||||
private ApplicationMode parent;
|
||||
private int mapIconId = R.drawable.ic_browse_map;
|
||||
private int mapIconId = R.drawable.map_world_globe_dark;
|
||||
private int smallIconDark = R.drawable.ic_world_globe_dark;
|
||||
private float defaultSpeed = 10f;
|
||||
private int minDistanceForTurn = 50;
|
||||
private int arrivalDistance = 90;
|
||||
private int bearingIconDay = R.drawable.map_pedestrian_bearing;
|
||||
private int bearingIconNight = R.drawable.map_pedestrian_bearing_night;
|
||||
private int headingIconDay = R.drawable.map_pedestrian_location_view_angle;
|
||||
private int headingIconNight = R.drawable.map_pedestrian_location_view_angle_night;
|
||||
private int locationIconDay = R.drawable.map_pedestrian_location;
|
||||
private int locationIconNight = R.drawable.map_pedestrian_location_night;
|
||||
private static StateChangedListener<String> listener;
|
||||
|
|
|
@ -26,17 +26,16 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
|||
private static final Log LOG = PlatformUtil.getLog(PointLocationLayer.class);
|
||||
|
||||
protected final static int RADIUS = 7;
|
||||
protected final static float HEADING_ANGLE = 60;
|
||||
|
||||
|
||||
private Paint locationPaint;
|
||||
private Paint area;
|
||||
private Paint aroundArea;
|
||||
private Paint headingPaint;
|
||||
|
||||
|
||||
private OsmandMapTileView view;
|
||||
|
||||
private ApplicationMode appMode;
|
||||
private Bitmap bearingIcon;
|
||||
private Bitmap headingIcon;
|
||||
private Bitmap locationIcon;
|
||||
private OsmAndLocationProvider locationProvider;
|
||||
private MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||
|
@ -51,8 +50,7 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
|||
locationPaint.setAntiAlias(true);
|
||||
locationPaint.setFilterBitmap(true);
|
||||
locationPaint.setDither(true);
|
||||
|
||||
|
||||
|
||||
area = new Paint();
|
||||
area.setColor(view.getResources().getColor(R.color.pos_area));
|
||||
|
||||
|
@ -62,11 +60,6 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
|||
aroundArea.setStrokeWidth(1);
|
||||
aroundArea.setAntiAlias(true);
|
||||
|
||||
headingPaint = new Paint();
|
||||
headingPaint.setColor(view.getResources().getColor(R.color.pos_heading));
|
||||
headingPaint.setAntiAlias(true);
|
||||
headingPaint.setStyle(Style.FILL);
|
||||
|
||||
updateIcons(view.getSettings().getApplicationMode(), false);
|
||||
locationProvider = view.getApplication().getLocationProvider();
|
||||
}
|
||||
|
@ -113,8 +106,13 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
|||
|
||||
Float heading = locationProvider.getHeading();
|
||||
if (heading != null && mapViewTrackingUtilities.isShowViewAngle()) {
|
||||
canvas.drawArc(getHeadingRect(locationX, locationY), heading - HEADING_ANGLE / 2 - 90, HEADING_ANGLE,
|
||||
true, headingPaint);
|
||||
|
||||
canvas.save();
|
||||
canvas.rotate(heading - 180, locationX, locationY);
|
||||
canvas.drawBitmap(headingIcon, locationX - headingIcon.getWidth() / 2,
|
||||
locationY - headingIcon.getHeight() / 2, locationPaint);
|
||||
canvas.restore();
|
||||
|
||||
}
|
||||
if (isBearing) {
|
||||
float bearing = lastKnownLocation.getBearing();
|
||||
|
@ -147,12 +145,16 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
|||
final int resourceBearing = nighMode ? resourceBearingNight : resourceBearingDay;
|
||||
bearingIcon = BitmapFactory.decodeResource(view.getResources(), resourceBearing);
|
||||
|
||||
final int resourceHeadingDay = appMode.getResourceHeadingDay();
|
||||
final int resourceHeadingNight = appMode.getResourceHeadingNight();
|
||||
final int resourceHeading = nighMode ? resourceHeadingNight : resourceHeadingDay;
|
||||
headingIcon = BitmapFactory.decodeResource(view.getResources(), resourceHeading);
|
||||
|
||||
final int resourceLocationDay = appMode.getResourceLocationDay();
|
||||
final int resourceLocationNight = appMode.getResourceLocationNight();
|
||||
final int resourceLocation = nighMode ? resourceLocationNight : resourceLocationDay;
|
||||
locationIcon = BitmapFactory.decodeResource(view.getResources(), resourceLocation);
|
||||
area.setColor(view.getResources().getColor(!nm ? R.color.pos_area : R.color.pos_area_night));
|
||||
headingPaint.setColor(view.getResources().getColor(!nm ? R.color.pos_heading : R.color.pos_heading_night));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue