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 {
|
||||
TransportStop dataObject = new TransportStop();
|
||||
dataObject.setFileOffset(codedIS.getTotalBytesRead());
|
||||
// dataObject.setReferencesToRoutes(new int[] {filePointer});
|
||||
dataObject.setReferencesToRoutes(new int[] {filePointer});
|
||||
boolean end = false;
|
||||
while(!end){
|
||||
int t = codedIS.readTag();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<item>
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/list_background_color_dark" />
|
||||
android:color="@color/activity_background_color_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -340,7 +340,7 @@
|
|||
<color name="ctx_menu_buttons_bg_light">#f2f2f2</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_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_icon_color">#727272</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));
|
||||
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);
|
||||
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()) {
|
||||
buttonsTopBorder.setVisibility(View.GONE);
|
||||
buttons.setVisibility(View.GONE);
|
||||
}
|
||||
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()) {
|
||||
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 Paint paintIcon;
|
||||
private Paint paintWhiteIcon;
|
||||
private Paint paintLightIcon;
|
||||
private Paint paintDarkIcon;
|
||||
private Bitmap backgroundIcon;
|
||||
private Bitmap stopBus;
|
||||
private Bitmap stopSmall;
|
||||
|
@ -64,15 +65,17 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
@Override
|
||||
public void initLayer(final OsmandMapTileView view) {
|
||||
backgroundIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_bg);
|
||||
backgroundIconHalfWidth = backgroundIcon.getWidth() / 2;
|
||||
backgroundIconHalfHeight = backgroundIcon.getWidth() / 2;
|
||||
backgroundIconHalfWidth = backgroundIcon.getWidth() / 2f;
|
||||
backgroundIconHalfHeight = backgroundIcon.getWidth() / 2f;
|
||||
this.view = view;
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
WindowManager wmgr = (WindowManager) view.getContext().getSystemService(Context.WINDOW_SERVICE);
|
||||
wmgr.getDefaultDisplay().getMetrics(dm);
|
||||
paintIcon = new Paint();
|
||||
paintWhiteIcon = new Paint();
|
||||
paintWhiteIcon.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(mapActivity,R.color.text_color_tab_active_dark), PorterDuff.Mode.SRC_IN));
|
||||
paintLightIcon = new Paint();
|
||||
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();
|
||||
stopBus = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_bus);
|
||||
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,
|
||||
List<TransportStop> objects) {
|
||||
private void getFromPoint(RotatedTileBox tb, PointF point, List<? super TransportStop> res,
|
||||
List<TransportStop> objects) {
|
||||
int ex = (int) point.x;
|
||||
int ey = (int) point.y;
|
||||
final int rp = getRadiusPoi(tb);
|
||||
|
@ -169,7 +172,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
this.showTransportStops = showTransportStops;
|
||||
}
|
||||
|
||||
public int getRadiusPoi(RotatedTileBox tb){
|
||||
private int getRadiusPoi(RotatedTileBox tb){
|
||||
final double zoom = tb.getZoom();
|
||||
int r;
|
||||
if(zoom < startZoomRoute){
|
||||
|
@ -189,10 +192,11 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
@Override
|
||||
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
|
||||
List<TransportStop> objects = null;
|
||||
boolean nightMode = settings.isNightMode();
|
||||
if (tb.getZoom() >= startZoomRoute) {
|
||||
if (stopRoute != null) {
|
||||
objects = stopRoute.route.getForwardStops();
|
||||
int color = stopRoute.getColor(mapActivity.getMyApplication(), settings.isNightMode());
|
||||
int color = stopRoute.getColor(mapActivity.getMyApplication(), nightMode);
|
||||
attrs.paint.setColor(color);
|
||||
attrs.updatePaints(view.getApplication(), settings, tb);
|
||||
try {
|
||||
|
@ -233,7 +237,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
float y = tb.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
|
||||
|
||||
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 {
|
||||
fullObjects.add(o);
|
||||
}
|
||||
|
@ -247,11 +251,11 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
if (type != null) {
|
||||
Bitmap foregroundIcon = RenderingIcons.getIcon(mapActivity, type.getResName(), false);
|
||||
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 {
|
||||
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