1 | /**
|
1 | /**
|
2 | * ZANavi, Zoff Android Navigation system.
|
2 | * ZANavi, Zoff Android Navigation system.
|
3 | * Copyright (C) 2011 Zoff <zoff@zoff.cc>
|
3 | * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
|
4 | *
|
4 | *
|
5 | * This program is free software; you can redistribute it and/or
|
5 | * This program is free software; you can redistribute it and/or
|
6 | * modify it under the terms of the GNU General Public License
|
6 | * modify it under the terms of the GNU General Public License
|
7 | * version 2 as published by the Free Software Foundation.
|
7 | * version 2 as published by the Free Software Foundation.
|
8 | *
|
8 | *
|
… | |
… | |
39 |
|
39 |
|
40 | public static Handler progress_handler_ = new Handler();
|
40 | public static Handler progress_handler_ = new Handler();
|
41 |
|
41 |
|
42 | private static Boolean show_scale = false;
|
42 | private static Boolean show_scale = false;
|
43 |
|
43 |
|
|
|
44 | private static Boolean one_shot = false;
|
|
|
45 | private static long last_paint_me = 0L;
|
|
|
46 |
|
44 | static Bitmap compass_b = null;
|
47 | static Bitmap compass_b = null;
|
45 | static Canvas compass_c = null;
|
48 | static Canvas compass_c = null;
|
46 | static int compass_radius = 0;
|
49 | static int compass_radius = 0;
|
47 | static int compass_center_x = 0;
|
50 | static int compass_center_x = 0;
|
48 | static int compass_center_y = 0;
|
51 | static int compass_center_y = 0;
|
… | |
… | |
74 |
|
77 |
|
75 | static Bitmap nt_b = null;
|
78 | static Bitmap nt_b = null;
|
76 | static Canvas nt_c = null;
|
79 | static Canvas nt_c = null;
|
77 | static int nt_lt_x = 0;
|
80 | static int nt_lt_x = 0;
|
78 | static int nt_lt_y = 0;
|
81 | static int nt_lt_y = 0;
|
|
|
82 | static int nt_lt_xB = 0;
|
|
|
83 | static int nt_lt_yB = 0;
|
79 | static int nt_text_start_x = 0;
|
84 | static int nt_text_start_x = 0;
|
80 | static int nt_text_start_y = 0;
|
85 | static int nt_text_start_y = 0;
|
81 | static int nt_w = 0;
|
86 | static int nt_w = 0;
|
82 | static int nt_h = 0;
|
87 | static int nt_h = 0;
|
83 | static int nt_font_size = 0;
|
88 | static int nt_font_size = 0;
|
… | |
… | |
109 |
|
114 |
|
110 | static int nextt_lt_x = 0;
|
115 | static int nextt_lt_x = 0;
|
111 | static int nextt_lt_y = 0;
|
116 | static int nextt_lt_y = 0;
|
112 | static int nextt_w = 0;
|
117 | static int nextt_w = 0;
|
113 | static int nextt_h = 0;
|
118 | static int nextt_h = 0;
|
|
|
119 | static int nextt_lt_xB = 0;
|
|
|
120 | static int nextt_lt_yB = 0;
|
|
|
121 | static int nextt_wB = 0;
|
|
|
122 | static int nextt_hB = 0;
|
|
|
123 |
|
|
|
124 | static int nextt_str_ltx = 0;
|
|
|
125 | static int nextt_str_lty = 0;
|
|
|
126 | static int nextt_str_ltxB = 0;
|
|
|
127 | static int nextt_str_ltyB = 0;
|
|
|
128 | static int nextt_str_w = 0;
|
|
|
129 | static int nextt_str_h = 0;
|
|
|
130 | static int nextt_str_wB = 0;
|
|
|
131 | static int nextt_str_hB = 0;
|
|
|
132 | static int nextt_str_font_size = 0;
|
|
|
133 | static int nextt_str_start_x = 0;
|
|
|
134 | static int nextt_str_start_y = 0;
|
114 |
|
135 |
|
115 | static int sat_status_lt_x = 0;
|
136 | static int sat_status_lt_x = 0;
|
116 | static int sat_status_lt_y = 0;
|
137 | static int sat_status_lt_y = 0;
|
117 | static int sat_status_lt_w = 0;
|
138 | static int sat_status_lt_w = 0;
|
118 | static int sat_status_lt_h = 0;
|
139 | static int sat_status_lt_h = 0;
|
… | |
… | |
228 | scale_lt_y = (int) (65);
|
249 | scale_lt_y = (int) (65);
|
229 | scale_text_start_x = (int) (10 * real_factor);
|
250 | scale_text_start_x = (int) (10 * real_factor);
|
230 | scale_text_start_y = (int) (30 * real_factor);
|
251 | scale_text_start_y = (int) (30 * real_factor);
|
231 | scale_font_size = (int) (24 * real_factor);
|
252 | scale_font_size = (int) (24 * real_factor);
|
232 |
|
253 |
|
|
|
254 | // next turn icons
|
233 | nextt_w = (int) (100 * real_factor);
|
255 | nextt_w = (int) (100 * real_factor);
|
234 | nextt_h = (int) (100 * real_factor);
|
256 | nextt_h = (int) (100 * real_factor);
|
235 | nextt_lt_x = (int) (10 * real_factor);
|
257 | nextt_lt_x = (int) (10 * real_factor);
|
236 | nextt_lt_y = (int) (mCanvasHeight - 50 * real_factor) - nextt_h - 5;
|
258 | nextt_lt_y = (int) (mCanvasHeight - 50 * real_factor) - nextt_h - 5;
|
|
|
259 | // next turn icons
|
237 |
|
260 |
|
|
|
261 | // next turn icons -- BIG --
|
|
|
262 | int smaller_size = mCanvasWidth;
|
|
|
263 | float shrink_factor = 0.65f;
|
|
|
264 | if (mCanvasWidth > mCanvasHeight)
|
|
|
265 | {
|
|
|
266 | // phone is turned in landscape-mode
|
|
|
267 | smaller_size = mCanvasHeight;
|
|
|
268 | shrink_factor = 0.43f;
|
|
|
269 | }
|
|
|
270 |
|
|
|
271 | nextt_wB = (int) (smaller_size * shrink_factor);
|
|
|
272 | nextt_hB = (int) (smaller_size * shrink_factor);
|
|
|
273 | nextt_lt_xB = (int) ((mCanvasWidth - nextt_wB) / 2);
|
|
|
274 | nextt_lt_yB = (int) (60 * real_factor);
|
|
|
275 | // next turn icons -- BIG --
|
|
|
276 |
|
|
|
277 | // next turn streetname --
|
|
|
278 | nextt_str_w = mCanvasWidth;
|
|
|
279 | nextt_str_h = (int) (65 * real_factor);
|
|
|
280 | nextt_str_ltx = 0;
|
|
|
281 | nextt_str_lty = 20;
|
|
|
282 | nextt_str_font_size = (int) (41 * real_factor);
|
|
|
283 | nextt_str_start_x = 8;
|
|
|
284 | nextt_str_start_y = (int) (46 * real_factor);
|
|
|
285 | // next turn streetname --
|
|
|
286 |
|
|
|
287 | // next turn streetname -- BIG --
|
|
|
288 | nextt_str_wB = mCanvasWidth;
|
|
|
289 | nextt_str_hB = (int) (65 * real_factor);
|
|
|
290 | nextt_str_ltxB = 0;
|
|
|
291 | nextt_str_ltyB = nextt_lt_yB + nextt_hB + 4;
|
|
|
292 | // next turn streetname -- BIG --
|
|
|
293 |
|
|
|
294 | // next turn in XX m --
|
238 | nt_w = (int) (100 * real_factor);
|
295 | nt_w = (int) (100 * real_factor);
|
239 | nt_h = (int) (40 * real_factor);
|
296 | nt_h = (int) (40 * real_factor);
|
240 | nt_lt_x = (int) (10 * real_factor);
|
297 | nt_lt_x = (int) (10 * real_factor);
|
241 | nt_lt_y = (int) (mCanvasHeight - 50 * real_factor);
|
298 | nt_lt_y = (int) (mCanvasHeight - 50 * real_factor);
|
242 | nt_text_start_x = (int) (20 * real_factor);
|
299 | nt_text_start_x = (int) (20 * real_factor);
|
243 | nt_text_start_y = (int) (30 * real_factor);
|
300 | nt_text_start_y = (int) (30 * real_factor);
|
244 | nt_font_size = (int) (24 * real_factor);
|
301 | nt_font_size = (int) (24 * real_factor);
|
|
|
302 | // next turn in XX m --
|
|
|
303 |
|
|
|
304 | // next turn in XX m -- BIG --
|
|
|
305 | nt_lt_xB = nextt_lt_xB;
|
|
|
306 | nt_lt_yB = nextt_lt_yB - nt_h - 4;
|
|
|
307 | // next turn in XX m -- BIG --
|
245 |
|
308 |
|
246 | if (compass_b != null)
|
309 | if (compass_b != null)
|
247 | {
|
310 | {
|
248 | compass_b.recycle();
|
311 | compass_b.recycle();
|
249 | }
|
312 | }
|
… | |
… | |
287 |
|
350 |
|
288 | }
|
351 | }
|
289 |
|
352 |
|
290 | public static void draw_real()
|
353 | public static void draw_real()
|
291 | {
|
354 | {
|
|
|
355 | //if (!NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
356 | //{
|
|
|
357 | /*
|
|
|
358 | * if ((last_paint_me + 100) < System.currentTimeMillis())
|
|
|
359 | * {
|
|
|
360 | * try
|
|
|
361 | * {
|
|
|
362 | * last_paint_me = System.currentTimeMillis();
|
|
|
363 | * }
|
|
|
364 | * catch (Exception r)
|
|
|
365 | * {
|
|
|
366 | * //r.printStackTrace();
|
|
|
367 | * }
|
|
|
368 | * }
|
|
|
369 | * else
|
|
|
370 | * {
|
|
|
371 | * return;
|
|
|
372 | * }
|
|
|
373 | */
|
|
|
374 | //}
|
|
|
375 | //System.out.println("draw real 1");
|
|
|
376 |
|
292 | try
|
377 | try
|
293 | {
|
378 | {
|
294 | compass_c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
|
379 | compass_c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
|
295 | ddtt_c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
|
380 | ddtt_c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
|
296 | scale_c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
|
381 | scale_c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
|
… | |
… | |
302 | // ddtt_c.drawColor(Color.CYAN);
|
387 | // ddtt_c.drawColor(Color.CYAN);
|
303 |
|
388 |
|
304 | int dest_valid = NavitGraphics.CallbackDestinationValid2();
|
389 | int dest_valid = NavitGraphics.CallbackDestinationValid2();
|
305 |
|
390 |
|
306 | did_draw_circle = false;
|
391 | did_draw_circle = false;
|
|
|
392 | if (!NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
393 | {
|
|
|
394 |
|
307 | if (Navit.OSD_compass.angle_north_valid)
|
395 | if (Navit.OSD_compass.angle_north_valid)
|
308 | {
|
396 | {
|
309 | paint.setColor(Color.BLACK);
|
397 | paint.setColor(Color.BLACK);
|
310 | paint.setStyle(Paint.Style.STROKE);
|
398 | paint.setStyle(Paint.Style.STROKE);
|
311 | paint.setStrokeWidth(2);
|
399 | paint.setStrokeWidth(2);
|
312 | paint.setAntiAlias(true);
|
400 | paint.setAntiAlias(true);
|
313 | compass_c.drawCircle(compass_center_x, compass_center_y, compass_radius, paint);
|
|
|
314 | did_draw_circle = true;
|
|
|
315 | int end_x = (int) ((float) Math.sin((float) Math.toRadians(Navit.OSD_compass.angle_north)) * compass_radius);
|
|
|
316 | int end_y = (int) ((float) Math.cos((float) Math.toRadians(Navit.OSD_compass.angle_north)) * compass_radius);
|
|
|
317 | // System.out.println("x " + end_x + " y " + end_y);
|
|
|
318 | compass_c.drawLine(compass_center_x - end_x, compass_center_y + end_y, compass_center_x, compass_center_y, paint);
|
|
|
319 | paint.setColor(Color.RED);
|
|
|
320 | paint.setStrokeWidth(4);
|
|
|
321 | compass_c.drawLine(compass_center_x + end_x, compass_center_y - end_y, compass_center_x, compass_center_y, paint);
|
|
|
322 | }
|
|
|
323 | if ((Navit.OSD_compass.angle_target_valid) && (dest_valid > 0))
|
|
|
324 | {
|
|
|
325 | paint.setColor(Color.BLACK);
|
|
|
326 | paint.setStyle(Paint.Style.STROKE);
|
|
|
327 | paint.setStrokeWidth(2);
|
|
|
328 | paint.setAntiAlias(true);
|
|
|
329 | if (!did_draw_circle)
|
|
|
330 | {
|
|
|
331 | compass_c.drawCircle(compass_center_x, compass_center_y, compass_radius, paint);
|
401 | compass_c.drawCircle(compass_center_x, compass_center_y, compass_radius, paint);
|
332 | did_draw_circle = true;
|
402 | did_draw_circle = true;
|
|
|
403 | int end_x = (int) ((float) Math.sin((float) Math.toRadians(Navit.OSD_compass.angle_north)) * compass_radius);
|
|
|
404 | int end_y = (int) ((float) Math.cos((float) Math.toRadians(Navit.OSD_compass.angle_north)) * compass_radius);
|
|
|
405 | // System.out.println("x " + end_x + " y " + end_y);
|
|
|
406 | compass_c.drawLine(compass_center_x - end_x, compass_center_y + end_y, compass_center_x, compass_center_y, paint);
|
|
|
407 | paint.setColor(Color.RED);
|
|
|
408 | paint.setStrokeWidth(4);
|
|
|
409 | compass_c.drawLine(compass_center_x + end_x, compass_center_y - end_y, compass_center_x, compass_center_y, paint);
|
|
|
410 | }
|
|
|
411 | if ((Navit.OSD_compass.angle_target_valid) && (dest_valid > 0))
|
|
|
412 | {
|
|
|
413 | paint.setColor(Color.BLACK);
|
|
|
414 | paint.setStyle(Paint.Style.STROKE);
|
|
|
415 | paint.setStrokeWidth(2);
|
|
|
416 | paint.setAntiAlias(true);
|
|
|
417 | if (!did_draw_circle)
|
|
|
418 | {
|
|
|
419 | compass_c.drawCircle(compass_center_x, compass_center_y, compass_radius, paint);
|
|
|
420 | did_draw_circle = true;
|
333 | }
|
421 | }
|
334 | int end_x = (int) ((float) Math.sin((float) Math.toRadians(Navit.OSD_compass.angle_target)) * compass_radius);
|
422 | int end_x = (int) ((float) Math.sin((float) Math.toRadians(Navit.OSD_compass.angle_target)) * compass_radius);
|
335 | int end_y = (int) ((float) Math.cos((float) Math.toRadians(Navit.OSD_compass.angle_target)) * compass_radius);
|
423 | int end_y = (int) ((float) Math.cos((float) Math.toRadians(Navit.OSD_compass.angle_target)) * compass_radius);
|
336 | // System.out.println("x " + end_x + " y " + end_y);
|
424 | // System.out.println("x " + end_x + " y " + end_y);
|
337 | paint.setColor(Color.GREEN);
|
425 | paint.setColor(Color.GREEN);
|
338 | compass_c.drawLine(compass_center_x, compass_center_y, compass_center_x + end_x, compass_center_y - end_y, paint);
|
426 | compass_c.drawLine(compass_center_x, compass_center_y, compass_center_x + end_x, compass_center_y - end_y, paint);
|
339 | }
|
427 | }
|
|
|
428 | }
|
|
|
429 |
|
340 | if ((Navit.OSD_compass.direct_distance_to_target_valid) && (dest_valid > 0))
|
430 | if ((Navit.OSD_compass.direct_distance_to_target_valid) && (dest_valid > 0))
|
341 | {
|
431 | {
|
342 | paint.setColor(Color.argb(140, 136, 136, 136));
|
432 | paint.setColor(Color.argb(140, 136, 136, 136));
|
343 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
433 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
344 | paint.setStrokeWidth(2);
|
434 | paint.setStrokeWidth(2);
|
… | |
… | |
382 | paint.setAntiAlias(true);
|
472 | paint.setAntiAlias(true);
|
383 | dttarget_c.drawText(Navit.OSD_route_001.driving_distance_to_target, dttarget_text_start_x, dttarget_text_start_y, paint);
|
473 | dttarget_c.drawText(Navit.OSD_route_001.driving_distance_to_target, dttarget_text_start_x, dttarget_text_start_y, paint);
|
384 | }
|
474 | }
|
385 | if ((Navit.OSD_nextturn.nextturn_distance_valid) && (dest_valid > 0))
|
475 | if ((Navit.OSD_nextturn.nextturn_distance_valid) && (dest_valid > 0))
|
386 | {
|
476 | {
|
387 | paint.setColor(Color.argb(140, 136, 136, 136));
|
477 | if (NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
478 | {
|
|
|
479 | paint.setColor(Color.argb(255, 20, 20, 230));
|
388 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
480 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
389 | paint.setStrokeWidth(2);
|
481 | paint.setStrokeWidth(2);
|
390 | paint.setAntiAlias(true);
|
482 | paint.setAntiAlias(true);
|
391 | nt_c.drawRoundRect(new RectF(0, 0, nt_w, nt_h), 10, 10, paint);
|
483 | nt_c.drawRoundRect(new RectF(0, 0, nt_w, nt_h), 10, 10, paint);
|
392 |
|
484 |
|
393 | paint.setColor(Color.BLACK);
|
485 | paint.setColor(Color.WHITE);
|
394 | paint.setStrokeWidth(3);
|
486 | paint.setStrokeWidth(3);
|
395 | paint.setStyle(Paint.Style.FILL);
|
487 | paint.setStyle(Paint.Style.FILL);
|
396 | paint.setTextSize(nt_font_size);
|
488 | paint.setTextSize(nt_font_size);
|
397 | paint.setAntiAlias(true);
|
489 | paint.setAntiAlias(true);
|
398 | nt_c.drawText(Navit.OSD_nextturn.nextturn_distance, nt_text_start_x, nt_text_start_y, paint);
|
490 | nt_c.drawText(Navit.OSD_nextturn.nextturn_distance, nt_text_start_x, nt_text_start_y, paint);
|
|
|
491 | }
|
|
|
492 | else
|
|
|
493 | {
|
|
|
494 | paint.setColor(Color.argb(140, 136, 136, 136));
|
|
|
495 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
|
|
496 | paint.setStrokeWidth(2);
|
|
|
497 | paint.setAntiAlias(true);
|
|
|
498 | nt_c.drawRoundRect(new RectF(0, 0, nt_w, nt_h), 10, 10, paint);
|
|
|
499 |
|
|
|
500 | paint.setColor(Color.BLACK);
|
|
|
501 | paint.setStrokeWidth(3);
|
|
|
502 | paint.setStyle(Paint.Style.FILL);
|
|
|
503 | paint.setTextSize(nt_font_size);
|
|
|
504 | paint.setAntiAlias(true);
|
|
|
505 | nt_c.drawText(Navit.OSD_nextturn.nextturn_distance, nt_text_start_x, nt_text_start_y, paint);
|
|
|
506 | }
|
399 | }
|
507 | }
|
400 |
|
508 |
|
401 | if (show_scale)
|
509 | if (show_scale)
|
402 | {
|
510 | {
|
403 | if (Navit.OSD_scale.scale_valid)
|
511 | if (Navit.OSD_scale.scale_valid)
|
… | |
… | |
421 | catch (Exception e)
|
529 | catch (Exception e)
|
422 | {
|
530 | {
|
423 | e.printStackTrace();
|
531 | e.printStackTrace();
|
424 | }
|
532 | }
|
425 |
|
533 |
|
|
|
534 | if (NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
535 | {
|
|
|
536 | one_shot = true;
|
|
|
537 | }
|
426 | }
|
538 | }
|
427 |
|
539 |
|
428 | public void onDraw(Canvas c)
|
540 | public void onDraw(Canvas c)
|
429 | {
|
541 | {
|
|
|
542 | //System.out.println("draw real 2");
|
|
|
543 |
|
430 | try
|
544 | try
|
431 | {
|
545 | {
|
432 | c.drawBitmap(compass_b, compass_lt_x, compass_lt_y, null);
|
546 | c.drawBitmap(compass_b, compass_lt_x, compass_lt_y, null);
|
433 | }
|
547 | }
|
434 | catch (Exception e)
|
548 | catch (Exception e)
|
… | |
… | |
472 | }
|
586 | }
|
473 | }
|
587 | }
|
474 |
|
588 |
|
475 | try
|
589 | try
|
476 | {
|
590 | {
|
|
|
591 | if (NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
592 | {
|
|
|
593 | c.drawBitmap(nt_b, nt_lt_xB, nt_lt_yB, null);
|
|
|
594 | }
|
|
|
595 | else
|
|
|
596 | {
|
477 | c.drawBitmap(nt_b, nt_lt_x, nt_lt_y, null);
|
597 | c.drawBitmap(nt_b, nt_lt_x, nt_lt_y, null);
|
|
|
598 | }
|
478 | }
|
599 | }
|
479 | catch (Exception e)
|
600 | catch (Exception e)
|
480 | {
|
601 | {
|
481 | e.printStackTrace();
|
602 | e.printStackTrace();
|
482 | }
|
603 | }
|
483 |
|
604 |
|
484 | try
|
605 | try
|
485 | {
|
606 | {
|
486 | if ((Navit.OSD_nextturn.nextturn_image_valid) && (NavitGraphics.CallbackDestinationValid2() > 0))
|
607 | if ((Navit.OSD_nextturn.nextturn_streetname != null) || (Navit.PREF_follow_gps))
|
|
|
608 | {
|
|
|
609 | if (NavitGraphics.MAP_DISPLAY_OFF)
|
487 | {
|
610 | {
|
|
|
611 | paint.setColor(Color.argb(255, 20, 20, 230));
|
|
|
612 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
|
|
613 | paint.setStrokeWidth(2);
|
|
|
614 | paint.setAntiAlias(true);
|
|
|
615 | c.drawRoundRect(new RectF(nextt_str_ltxB, nextt_str_ltyB, nextt_str_ltxB + nextt_str_wB, nextt_str_ltyB + nextt_str_hB), 10, 10, paint);
|
|
|
616 | paint.setColor(Color.WHITE);
|
|
|
617 | paint.setStrokeWidth(3);
|
|
|
618 | paint.setStyle(Paint.Style.FILL);
|
|
|
619 | if (Navit.OSD_nextturn.nextturn_streetname.length() > (nextt_str_ltxB + nextt_str_wB) / 25)
|
|
|
620 | {
|
|
|
621 | paint.setTextSize((int) (nextt_str_font_size * 0.70));
|
|
|
622 | }
|
|
|
623 | else
|
|
|
624 | {
|
|
|
625 | paint.setTextSize(nextt_str_font_size);
|
|
|
626 | }
|
|
|
627 | paint.setAntiAlias(true);
|
|
|
628 | c.drawText(Navit.OSD_nextturn.nextturn_streetname_systematic + " " + Navit.OSD_nextturn.nextturn_streetname, nextt_str_ltxB + nextt_str_start_x, nextt_str_ltyB + nextt_str_start_y, paint);
|
|
|
629 | }
|
|
|
630 | else
|
|
|
631 | {
|
488 | paint.setColor(Color.argb(140, 136, 136, 136));
|
632 | paint.setColor(Color.argb(140, 136, 136, 136));
|
489 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
633 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
490 | paint.setStrokeWidth(2);
|
634 | paint.setStrokeWidth(2);
|
491 | paint.setAntiAlias(true);
|
635 | paint.setAntiAlias(true);
|
492 | c.drawRoundRect(new RectF(nextt_lt_x, nextt_lt_y, nextt_lt_x + nextt_w, nextt_lt_y + nextt_h), 10, 10, paint);
|
636 | c.drawRoundRect(new RectF(nextt_str_ltxB, nextt_str_lty, nextt_str_ltx + nextt_str_w, nextt_str_lty + nextt_str_h), 10, 10, paint);
|
493 | Rect dst = new Rect(nextt_lt_x, nextt_lt_y, nextt_lt_x + nextt_w, nextt_lt_y + nextt_h);
|
637 | paint.setColor(Color.BLACK);
|
494 | c.drawBitmap(Navit.OSD_nextturn.nextturn_image, null, dst, null);
|
638 | paint.setStrokeWidth(3);
|
495 | // c.drawBitmap(Navit.OSD_nextturn.nextturn_image, nextt_lt_x, nextt_lt_y, null);
|
639 | paint.setStyle(Paint.Style.FILL);
|
|
|
640 | if (Navit.OSD_nextturn.nextturn_streetname.length() > (nextt_str_ltxB + nextt_str_wB) / 25)
|
|
|
641 | {
|
|
|
642 | paint.setTextSize((int) (nextt_str_font_size * 0.70));
|
|
|
643 | }
|
|
|
644 | else
|
|
|
645 | {
|
|
|
646 | paint.setTextSize(nextt_str_font_size);
|
|
|
647 | }
|
|
|
648 | paint.setAntiAlias(true);
|
|
|
649 | c.drawText(Navit.OSD_nextturn.nextturn_streetname_systematic + " " + Navit.OSD_nextturn.nextturn_streetname, nextt_str_ltx + nextt_str_start_x, nextt_str_lty + nextt_str_start_y, paint);
|
|
|
650 | }
|
496 | }
|
651 | }
|
497 | else
|
652 | else
|
498 | {
|
653 | {
|
499 | paint.setColor(Color.argb(0, 0, 0, 0));
|
654 | paint.setColor(Color.argb(0, 0, 0, 0));
|
500 | paint.setStyle(Paint.Style.FILL);
|
655 | paint.setStyle(Paint.Style.FILL);
|
501 | paint.setStrokeWidth(3);
|
656 | paint.setStrokeWidth(3);
|
502 | paint.setAntiAlias(false);
|
657 | paint.setAntiAlias(false);
|
|
|
658 | if (NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
659 | {
|
|
|
660 | c.drawRect(new RectF(nextt_str_ltxB, nextt_str_ltyB, nextt_str_ltxB + nextt_str_wB, nextt_str_ltyB + nextt_str_hB), paint);
|
|
|
661 | }
|
|
|
662 | else
|
|
|
663 | {
|
|
|
664 | c.drawRect(new RectF(nextt_str_ltx, nextt_str_lty, nextt_str_ltx + nextt_str_w, nextt_str_lty + nextt_str_h), paint);
|
|
|
665 | }
|
|
|
666 | }
|
|
|
667 | }
|
|
|
668 | catch (Exception e)
|
|
|
669 | {
|
|
|
670 |
|
|
|
671 | }
|
|
|
672 |
|
|
|
673 | try
|
|
|
674 | {
|
|
|
675 | if ((Navit.OSD_nextturn.nextturn_image_valid) && (NavitGraphics.CallbackDestinationValid2() > 0))
|
|
|
676 | {
|
|
|
677 | if (NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
678 | {
|
|
|
679 | paint.setColor(Color.argb(255, 20, 20, 230));
|
|
|
680 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
|
|
681 | paint.setStrokeWidth(2);
|
|
|
682 | paint.setAntiAlias(true);
|
|
|
683 | c.drawRoundRect(new RectF(nextt_lt_xB, nextt_lt_yB, nextt_lt_xB + nextt_wB, nextt_lt_yB + nextt_hB), 10, 10, paint);
|
|
|
684 | Rect dst = new Rect(nextt_lt_xB, nextt_lt_yB, nextt_lt_xB + nextt_wB, nextt_lt_yB + nextt_hB);
|
|
|
685 | c.drawBitmap(Navit.OSD_nextturn.nextturn_image, null, dst, null);
|
|
|
686 | }
|
|
|
687 | else
|
|
|
688 | {
|
|
|
689 | paint.setColor(Color.argb(140, 136, 136, 136));
|
|
|
690 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
|
|
|
691 | paint.setStrokeWidth(2);
|
|
|
692 | paint.setAntiAlias(true);
|
|
|
693 | c.drawRoundRect(new RectF(nextt_lt_x, nextt_lt_y, nextt_lt_x + nextt_w, nextt_lt_y + nextt_h), 10, 10, paint);
|
|
|
694 | Rect dst = new Rect(nextt_lt_x, nextt_lt_y, nextt_lt_x + nextt_w, nextt_lt_y + nextt_h);
|
|
|
695 | c.drawBitmap(Navit.OSD_nextturn.nextturn_image, null, dst, null);
|
|
|
696 | }
|
|
|
697 | // c.drawBitmap(Navit.OSD_nextturn.nextturn_image, nextt_lt_x, nextt_lt_y, null);
|
|
|
698 | }
|
|
|
699 | else
|
|
|
700 | {
|
|
|
701 | paint.setColor(Color.argb(0, 0, 0, 0));
|
|
|
702 | paint.setStyle(Paint.Style.FILL);
|
|
|
703 | paint.setStrokeWidth(3);
|
|
|
704 | paint.setAntiAlias(false);
|
|
|
705 | if (NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
706 | {
|
|
|
707 | c.drawRect(new RectF(nextt_lt_xB, nextt_lt_yB, nextt_lt_xB + nextt_wB, nextt_lt_yB + nextt_hB), paint);
|
|
|
708 | }
|
|
|
709 | else
|
|
|
710 | {
|
503 | c.drawRect(new RectF(nextt_lt_x, nextt_lt_y, nextt_lt_x + nextt_w, nextt_lt_y + nextt_h), paint);
|
711 | c.drawRect(new RectF(nextt_lt_x, nextt_lt_y, nextt_lt_x + nextt_w, nextt_lt_y + nextt_h), paint);
|
|
|
712 | }
|
504 | //c.clipRect(nextt_lt_x, nextt_lt_y, nextt_lt_x + nextt_w, nextt_lt_y + nextt_h);
|
713 | //c.clipRect(nextt_lt_x, nextt_lt_y, nextt_lt_x + nextt_w, nextt_lt_y + nextt_h);
|
505 | //c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
|
714 | //c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
|
506 | }
|
715 | }
|
507 | }
|
716 | }
|
508 | catch (Exception e)
|
717 | catch (Exception e)
|
… | |
… | |
544 | }
|
753 | }
|
545 | }
|
754 | }
|
546 | catch (Exception e)
|
755 | catch (Exception e)
|
547 | {
|
756 | {
|
548 | e.printStackTrace();
|
757 | e.printStackTrace();
|
|
|
758 | }
|
|
|
759 |
|
|
|
760 | if (!Navit.PREF_follow_gps)
|
|
|
761 | {
|
|
|
762 | if (!NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
763 | {
|
|
|
764 | // show cross hair
|
|
|
765 | paint.setColor(Color.DKGRAY);
|
|
|
766 | paint.setStyle(Paint.Style.STROKE);
|
|
|
767 | paint.setStrokeWidth(1);
|
|
|
768 | paint.setAntiAlias(true);
|
|
|
769 | int wm = mCanvasWidth / 2;
|
|
|
770 | int hm = mCanvasHeight / 2;
|
|
|
771 | c.drawLine(wm - 8, hm, wm - 35, hm, paint);
|
|
|
772 | c.drawLine(wm + 8, hm, wm + 35, hm, paint);
|
|
|
773 | c.drawLine(wm, hm - 8, wm, hm - 35, paint);
|
|
|
774 | c.drawLine(wm, hm + 8, wm, hm + 35, paint);
|
|
|
775 | }
|
|
|
776 | }
|
|
|
777 |
|
|
|
778 | if (NavitGraphics.MAP_DISPLAY_OFF)
|
|
|
779 | {
|
|
|
780 | if (one_shot)
|
|
|
781 | {
|
|
|
782 | //System.out.println("one shot");
|
|
|
783 | one_shot = false;
|
|
|
784 | this.postInvalidate();
|
|
|
785 | }
|
549 | }
|
786 | }
|
550 | }
|
787 | }
|
551 |
|
788 |
|
552 | // @Override
|
789 | // @Override
|
553 | // public boolean onTouchEvent(MotionEvent event)
|
790 | // public boolean onTouchEvent(MotionEvent event)
|