Transport route/stop fixes
This commit is contained in:
parent
3067c7b038
commit
6a7b4fe8d5
5 changed files with 21 additions and 17 deletions
|
@ -482,7 +482,7 @@ public class BinaryMapTransportReaderAdapter {
|
||||||
int filePointer) throws IOException {
|
int filePointer) throws IOException {
|
||||||
TransportStop dataObject = new TransportStop();
|
TransportStop dataObject = new TransportStop();
|
||||||
dataObject.setFileOffset(codedIS.getTotalBytesRead());
|
dataObject.setFileOffset(codedIS.getTotalBytesRead());
|
||||||
// dataObject.setReferencesToRoutes(new int[] {filePointer});
|
dataObject.setReferencesToRoutes(new int[] {filePointer});
|
||||||
boolean end = false;
|
boolean end = false;
|
||||||
while(!end){
|
while(!end){
|
||||||
int t = codedIS.readTag();
|
int t = codedIS.readTag();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<item>
|
<item>
|
||||||
<shape>
|
<shape>
|
||||||
<solid
|
<solid
|
||||||
android:color="@color/list_background_color_dark" />
|
android:color="@color/activity_background_color_dark" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</layer-list>
|
|
@ -340,7 +340,7 @@
|
||||||
<color name="ctx_menu_buttons_bg_light">#f2f2f2</color>
|
<color name="ctx_menu_buttons_bg_light">#f2f2f2</color>
|
||||||
<color name="ctx_menu_buttons_bg_dark">#222526</color>
|
<color name="ctx_menu_buttons_bg_dark">#222526</color>
|
||||||
<color name="ctx_menu_buttons_divider_light">#e6e6e6</color>
|
<color name="ctx_menu_buttons_divider_light">#e6e6e6</color>
|
||||||
<color name="ctx_menu_buttons_divider_dark">#2d3133</color>
|
<color name="ctx_menu_buttons_divider_dark">#2c3033</color>
|
||||||
<color name="ctx_menu_buttons_text_color">#727272</color>
|
<color name="ctx_menu_buttons_text_color">#727272</color>
|
||||||
<color name="ctx_menu_buttons_icon_color">#727272</color>
|
<color name="ctx_menu_buttons_icon_color">#727272</color>
|
||||||
<color name="ctx_menu_bottom_buttons_text_color_light">#536dfe</color>
|
<color name="ctx_menu_bottom_buttons_text_color_light">#536dfe</color>
|
||||||
|
|
|
@ -537,13 +537,13 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
buttonsBottomBorder.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.ctx_menu_buttons_divider_dark : R.color.ctx_menu_buttons_divider_light));
|
buttonsBottomBorder.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.ctx_menu_buttons_divider_dark : R.color.ctx_menu_buttons_divider_light));
|
||||||
buttonsTopBorder.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.ctx_menu_buttons_divider_dark : R.color.ctx_menu_buttons_divider_light));
|
buttonsTopBorder.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.ctx_menu_buttons_divider_dark : R.color.ctx_menu_buttons_divider_light));
|
||||||
View buttons = view.findViewById(R.id.context_menu_buttons);
|
View buttons = view.findViewById(R.id.context_menu_buttons);
|
||||||
buttons.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.ctx_menu_buttons_bg_dark : R.color.ctx_menu_buttons_bg_light));
|
buttons.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.list_background_color_dark : R.color.activity_background_color_light));
|
||||||
if (!menu.buttonsVisible()) {
|
if (!menu.buttonsVisible()) {
|
||||||
buttonsTopBorder.setVisibility(View.GONE);
|
buttonsTopBorder.setVisibility(View.GONE);
|
||||||
buttons.setVisibility(View.GONE);
|
buttons.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
View bottomButtons = view.findViewById(R.id.context_menu_bottom_buttons);
|
View bottomButtons = view.findViewById(R.id.context_menu_bottom_buttons);
|
||||||
bottomButtons.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.ctx_menu_buttons_bg_dark : R.color.ctx_menu_buttons_bg_light));
|
bottomButtons.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.list_background_color_dark : R.color.activity_background_color_light));
|
||||||
if (!menu.navigateButtonVisible()) {
|
if (!menu.navigateButtonVisible()) {
|
||||||
bottomButtons.findViewById(R.id.context_menu_directions_button).setVisibility(View.GONE);
|
bottomButtons.findViewById(R.id.context_menu_directions_button).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,8 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
private OsmandMapTileView view;
|
private OsmandMapTileView view;
|
||||||
|
|
||||||
private Paint paintIcon;
|
private Paint paintIcon;
|
||||||
private Paint paintWhiteIcon;
|
private Paint paintLightIcon;
|
||||||
|
private Paint paintDarkIcon;
|
||||||
private Bitmap backgroundIcon;
|
private Bitmap backgroundIcon;
|
||||||
private Bitmap stopBus;
|
private Bitmap stopBus;
|
||||||
private Bitmap stopSmall;
|
private Bitmap stopSmall;
|
||||||
|
@ -64,15 +65,17 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
@Override
|
@Override
|
||||||
public void initLayer(final OsmandMapTileView view) {
|
public void initLayer(final OsmandMapTileView view) {
|
||||||
backgroundIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_bg);
|
backgroundIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_bg);
|
||||||
backgroundIconHalfWidth = backgroundIcon.getWidth() / 2;
|
backgroundIconHalfWidth = backgroundIcon.getWidth() / 2f;
|
||||||
backgroundIconHalfHeight = backgroundIcon.getWidth() / 2;
|
backgroundIconHalfHeight = backgroundIcon.getWidth() / 2f;
|
||||||
this.view = view;
|
this.view = view;
|
||||||
DisplayMetrics dm = new DisplayMetrics();
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
WindowManager wmgr = (WindowManager) view.getContext().getSystemService(Context.WINDOW_SERVICE);
|
WindowManager wmgr = (WindowManager) view.getContext().getSystemService(Context.WINDOW_SERVICE);
|
||||||
wmgr.getDefaultDisplay().getMetrics(dm);
|
wmgr.getDefaultDisplay().getMetrics(dm);
|
||||||
paintIcon = new Paint();
|
paintIcon = new Paint();
|
||||||
paintWhiteIcon = new Paint();
|
paintLightIcon = new Paint();
|
||||||
paintWhiteIcon.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(mapActivity,R.color.text_color_tab_active_dark), PorterDuff.Mode.SRC_IN));
|
paintLightIcon.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(mapActivity, R.color.active_buttons_and_links_text_light), PorterDuff.Mode.SRC_IN));
|
||||||
|
paintDarkIcon = new Paint();
|
||||||
|
paintDarkIcon.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(mapActivity, R.color.active_buttons_and_links_text_dark), PorterDuff.Mode.SRC_IN));
|
||||||
path = new Path();
|
path = new Path();
|
||||||
stopBus = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_bus);
|
stopBus = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_bus);
|
||||||
stopSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_small);
|
stopSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_small);
|
||||||
|
@ -124,8 +127,8 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getFromPoint(RotatedTileBox tb, PointF point, List<? super TransportStop> res,
|
private void getFromPoint(RotatedTileBox tb, PointF point, List<? super TransportStop> res,
|
||||||
List<TransportStop> objects) {
|
List<TransportStop> objects) {
|
||||||
int ex = (int) point.x;
|
int ex = (int) point.x;
|
||||||
int ey = (int) point.y;
|
int ey = (int) point.y;
|
||||||
final int rp = getRadiusPoi(tb);
|
final int rp = getRadiusPoi(tb);
|
||||||
|
@ -169,7 +172,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
this.showTransportStops = showTransportStops;
|
this.showTransportStops = showTransportStops;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRadiusPoi(RotatedTileBox tb){
|
private int getRadiusPoi(RotatedTileBox tb){
|
||||||
final double zoom = tb.getZoom();
|
final double zoom = tb.getZoom();
|
||||||
int r;
|
int r;
|
||||||
if(zoom < startZoomRoute){
|
if(zoom < startZoomRoute){
|
||||||
|
@ -189,10 +192,11 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
|
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
|
||||||
List<TransportStop> objects = null;
|
List<TransportStop> objects = null;
|
||||||
|
boolean nightMode = settings.isNightMode();
|
||||||
if (tb.getZoom() >= startZoomRoute) {
|
if (tb.getZoom() >= startZoomRoute) {
|
||||||
if (stopRoute != null) {
|
if (stopRoute != null) {
|
||||||
objects = stopRoute.route.getForwardStops();
|
objects = stopRoute.route.getForwardStops();
|
||||||
int color = stopRoute.getColor(mapActivity.getMyApplication(), settings.isNightMode());
|
int color = stopRoute.getColor(mapActivity.getMyApplication(), nightMode);
|
||||||
attrs.paint.setColor(color);
|
attrs.paint.setColor(color);
|
||||||
attrs.updatePaints(view.getApplication(), settings, tb);
|
attrs.updatePaints(view.getApplication(), settings, tb);
|
||||||
try {
|
try {
|
||||||
|
@ -233,7 +237,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
float y = tb.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
|
float y = tb.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
|
||||||
|
|
||||||
if (intersects(boundIntersections, x, y, iconSize, iconSize)) {
|
if (intersects(boundIntersections, x, y, iconSize, iconSize)) {
|
||||||
canvas.drawBitmap(stopSmall, x - stopSmall.getWidth() / 2, y - stopSmall.getHeight() / 2, paintIcon);
|
canvas.drawBitmap(stopSmall, x - stopSmall.getWidth() / 2f, y - stopSmall.getHeight() / 2f, paintIcon);
|
||||||
} else {
|
} else {
|
||||||
fullObjects.add(o);
|
fullObjects.add(o);
|
||||||
}
|
}
|
||||||
|
@ -247,11 +251,11 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
Bitmap foregroundIcon = RenderingIcons.getIcon(mapActivity, type.getResName(), false);
|
Bitmap foregroundIcon = RenderingIcons.getIcon(mapActivity, type.getResName(), false);
|
||||||
canvas.drawBitmap(backgroundIcon, x - backgroundIconHalfWidth, y - backgroundIconHalfHeight, paintIcon);
|
canvas.drawBitmap(backgroundIcon, x - backgroundIconHalfWidth, y - backgroundIconHalfHeight, paintIcon);
|
||||||
canvas.drawBitmap(foregroundIcon, x - foregroundIcon.getWidth() / 2, y - foregroundIcon.getHeight() / 2, paintWhiteIcon);
|
canvas.drawBitmap(foregroundIcon, x - foregroundIcon.getWidth() / 2f, y - foregroundIcon.getHeight() / 2f, nightMode ? paintDarkIcon : paintLightIcon);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Bitmap b = stopBus;
|
Bitmap b = stopBus;
|
||||||
canvas.drawBitmap(b, x - b.getWidth() / 2, y - b.getHeight() / 2, paintIcon);
|
canvas.drawBitmap(b, x - b.getWidth() / 2f, y - b.getHeight() / 2f, paintIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue