Add coloring outdated location mode
This commit is contained in:
parent
f09c1f8d74
commit
f18c8c8f77
1 changed files with 16 additions and 21 deletions
|
@ -61,22 +61,15 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initUI() {
|
private void initUI() {
|
||||||
locationPaint = new Paint();
|
locationPaint = new Paint(ANTI_ALIAS_FLAG | FILTER_BITMAP_FLAG);
|
||||||
locationPaint.setAntiAlias(true);
|
|
||||||
locationPaint.setFilterBitmap(true);
|
|
||||||
|
|
||||||
headingPaint = new Paint(ANTI_ALIAS_FLAG | FILTER_BITMAP_FLAG);
|
headingPaint = new Paint(ANTI_ALIAS_FLAG | FILTER_BITMAP_FLAG);
|
||||||
|
|
||||||
|
|
||||||
area = new Paint();
|
area = new Paint();
|
||||||
area.setColor(view.getResources().getColor(R.color.pos_area));
|
area.setColor(view.getResources().getColor(R.color.pos_area));
|
||||||
|
|
||||||
aroundArea = new Paint();
|
aroundArea = new Paint();
|
||||||
aroundArea.setColor(view.getResources().getColor(R.color.pos_around));
|
aroundArea.setColor(view.getResources().getColor(R.color.pos_around));
|
||||||
aroundArea.setStyle(Style.STROKE);
|
aroundArea.setStyle(Style.STROKE);
|
||||||
aroundArea.setStrokeWidth(1);
|
aroundArea.setStrokeWidth(1);
|
||||||
aroundArea.setAntiAlias(true);
|
aroundArea.setAntiAlias(true);
|
||||||
|
|
||||||
locationProvider = view.getApplication().getLocationProvider();
|
locationProvider = view.getApplication().getLocationProvider();
|
||||||
updateIcons(view.getSettings().getApplicationMode(), false, locationProvider.getLastKnownLocation() == null);
|
updateIcons(view.getSettings().getApplicationMode(), false, locationProvider.getLastKnownLocation() == null);
|
||||||
}
|
}
|
||||||
|
@ -167,11 +160,10 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
return l != null && tb.containsLatLon(l.getLatitude(), l.getLongitude());
|
return l != null && tb.containsLatLon(l.getLatitude(), l.getLongitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyLayer() {
|
public void destroyLayer() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateIcons(ApplicationMode appMode, boolean nighMode, boolean locationOutdated) {
|
private void updateIcons(ApplicationMode appMode, boolean nighMode, boolean locationOutdated) {
|
||||||
if (appMode != this.appMode || this.nm != nighMode || this.locationOutdated != locationOutdated ||
|
if (appMode != this.appMode || this.nm != nighMode || this.locationOutdated != locationOutdated ||
|
||||||
color != appMode.getIconColorInfo().getColor(nighMode)) {
|
color != appMode.getIconColorInfo().getColor(nighMode)) {
|
||||||
|
@ -181,24 +173,28 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
this.locationOutdated = locationOutdated;
|
this.locationOutdated = locationOutdated;
|
||||||
bearingIcon = BitmapFactory.decodeResource(view.getResources(), appMode.getResourceBearingDay());
|
bearingIcon = BitmapFactory.decodeResource(view.getResources(), appMode.getResourceBearingDay());
|
||||||
headingIcon = BitmapFactory.decodeResource(view.getResources(), appMode.getResourceHeadingDay());
|
headingIcon = BitmapFactory.decodeResource(view.getResources(), appMode.getResourceHeadingDay());
|
||||||
final int resourceLocation = appMode.getResourceLocationDay();
|
if (locationOutdated) {
|
||||||
locationPaint.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(view.getContext(), color),
|
locationPaint.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(view.getContext(),
|
||||||
PorterDuff.Mode.SRC_IN));
|
R.color.icon_color_secondary_light), PorterDuff.Mode.SRC_IN));
|
||||||
LayerDrawable layerDrawable = (LayerDrawable) ContextCompat.getDrawable(view.getContext(), resourceLocation);
|
} else {
|
||||||
if (layerDrawable != null) {
|
locationPaint.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(view.getContext(), color),
|
||||||
locationIconTop = ((BitmapDrawable) layerDrawable.getDrawable(0)).getBitmap();
|
PorterDuff.Mode.SRC_IN));
|
||||||
locationIconCenter = ((BitmapDrawable) layerDrawable.getDrawable(1)).getBitmap();
|
}
|
||||||
locationIconBottom = ((BitmapDrawable) layerDrawable.getDrawable(2)).getBitmap();
|
LayerDrawable layerDrawable = (LayerDrawable) ContextCompat.getDrawable(view.getContext(), appMode.getResourceLocationDay());
|
||||||
}
|
if (layerDrawable != null) {
|
||||||
|
locationIconTop = ((BitmapDrawable) layerDrawable.getDrawable(0)).getBitmap();
|
||||||
|
locationIconCenter = ((BitmapDrawable) layerDrawable.getDrawable(1)).getBitmap();
|
||||||
|
locationIconBottom = ((BitmapDrawable) layerDrawable.getDrawable(2)).getBitmap();
|
||||||
|
}
|
||||||
area.setColor(view.getResources().getColor(!nm ? R.color.pos_area : R.color.pos_area_night));
|
area.setColor(view.getResources().getColor(!nm ? R.color.pos_area : R.color.pos_area_night));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean drawInScreenPixels() {
|
public boolean drawInScreenPixels() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= 3) {
|
if (tileBox.getZoom() >= 3) {
|
||||||
|
@ -260,5 +256,4 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue