/[zanavi_public1]/navit/navit/android/src/com/zoffcc/applications/zanavi/NavitAndroidOverlay.java
ZANavi

Contents of /navit/navit/android/src/com/zoffcc/applications/zanavi/NavitAndroidOverlay.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28 - (show annotations) (download)
Sun Jun 17 08:12:47 2012 UTC (11 years, 10 months ago) by zoff99
File size: 23522 byte(s)
lots of new stuff and fixes
1 /**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011 Zoff <zoff@zoff.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 /**
21 * Navit, a modular navigation system.
22 * Copyright (C) 2005-2008 Navit Team
23 *
24 * This program is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU General Public License
26 * version 2 as published by the Free Software Foundation.
27 *
28 * This program is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU General Public License for more details.
32 *
33 * You should have received a copy of the GNU General Public License
34 * along with this program; if not, write to the
35 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
36 * Boston, MA 02110-1301, USA.
37 */
38
39 package com.zoffcc.applications.zanavi;
40
41 import android.content.Context;
42 import android.graphics.Canvas;
43 import android.graphics.Color;
44 import android.graphics.Paint;
45 import android.graphics.Paint.Style;
46 import android.graphics.RectF;
47 import android.os.Bundle;
48 import android.os.Message;
49 import android.view.MotionEvent;
50 import android.widget.ImageView;
51
52 public class NavitAndroidOverlay extends ImageView
53 {
54 public Boolean draw_bubble = false;
55 public static Boolean confirmed_bubble = false;
56 public long bubble_showing_since = 0L;
57 public static long bubble_max_showing_timespan = 8000L; // 8 secs.
58 public RectF follow_button_rect = new RectF(-100, 1, 1, 1);
59 public RectF zoomin_button_rect = new RectF(-100, 1, 1, 1);
60 public RectF zoomout_button_rect = new RectF(-100, 1, 1, 1);
61 public RectF mapdrawing_button_rect = new RectF(-100, 1, 1, 1);
62 public static int zoomin_ltx = 0;
63 public static int zoomin_lty = 0;
64 public static int zoomout_ltx = 0;
65 public static int zoomout_lty = 0;
66 public static int mapdrawing_ltx = 0;
67 public static int mapdrawing_lty = 0;
68 public int mCanvasHeight = 1;
69 public int mCanvasWidth = 1;
70 public static float draw_factor = 1.0f;
71
72 public static BubbleThread bubble_thread = null;
73
74 public static NavitGraphics.OverlayDrawThread overlay_draw_thread1;
75
76 private class BubbleThread extends Thread
77 {
78 private Boolean running;
79 private long bubble_showing_since = 0L;
80 private NavitAndroidOverlay a_overlay = null;
81
82 BubbleThread(NavitAndroidOverlay a_ov)
83 {
84 this.running = true;
85 this.a_overlay = a_ov;
86 this.bubble_showing_since = System.currentTimeMillis();
87 //Log.e("Navit", "BubbleThread created");
88 }
89
90 public void stop_me()
91 {
92 this.running = false;
93 }
94
95 public void run()
96 {
97 // Log.e("Navit", "BubbleThread started");
98 while (this.running)
99 {
100 if ((System.currentTimeMillis() - this.bubble_showing_since) > bubble_max_showing_timespan)
101 {
102 //Log.e("Navit", "BubbleThread: bubble displaying too long, hide it");
103 // with invalidate we call the onDraw() function, that will take care of it
104 this.a_overlay.postInvalidate();
105 this.running = false;
106 }
107 else
108 {
109 try
110 {
111 Thread.sleep(50);
112 }
113 catch (InterruptedException e)
114 {
115 // e.printStackTrace();
116 }
117 }
118 }
119 //Log.e("Navit", "BubbleThread ended");
120 }
121 }
122
123 public static class NavitAndroidOverlayBubble
124 {
125 int x;
126 int y;
127 String text = null;
128 }
129
130 private NavitAndroidOverlayBubble bubble_001 = null;
131
132 public NavitAndroidOverlay(Context context)
133 {
134 super(context);
135 }
136
137 public void show_bubble()
138 {
139 //Log.e("Navit", "NavitAndroidOverlay -> show_bubble");
140 if (!this.draw_bubble)
141 {
142 confirmed_bubble = false;
143 this.draw_bubble = true;
144 this.bubble_showing_since = System.currentTimeMillis();
145 bubble_thread = new BubbleThread(this);
146 bubble_thread.start();
147
148 // test test DEBUG
149 /*
150 * Message msg = new Message();
151 * Bundle b = new Bundle();
152 * b.putInt("Callback", 4);
153 * b.putInt("x", this.bubble_001.x);
154 * b.putInt("y", this.bubble_001.y);
155 * msg.setData(b);
156 * Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
157 */
158 }
159 }
160
161 public Boolean get_show_bubble()
162 {
163 return this.draw_bubble;
164 }
165
166 public void hide_bubble()
167 {
168 // Log.e("NavitGraphics", "NavitAndroidOverlay -> hide_bubble");
169 confirmed_bubble = false;
170 this.draw_bubble = false;
171 this.bubble_showing_since = 0L;
172 try
173 {
174 bubble_thread.stop_me();
175 // bubble_thread.stop();
176 }
177 catch (Exception e)
178 {
179
180 }
181 //this.postInvalidate();
182 }
183
184 public void set_bubble(NavitAndroidOverlayBubble b)
185 {
186 this.bubble_001 = b;
187 }
188
189 @Override
190 public boolean onTouchEvent(MotionEvent event)
191 {
192 //if (NavitGraphics.wait_for_redraw_map == true)
193 //{
194 // Log.e("NavitGraphics", "GD NavitAndroidOverlay GD -> onTouchEvent");
195 // Message msg = new Message();
196 // Bundle b = new Bundle();
197 // b.putInt("Callback", 50);
198 // msg.setData(b);
199 // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
200 //}
201 //else
202 //{
203 // // Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent");
204 //}
205 super.onTouchEvent(event);
206
207 int action = event.getAction();
208 int x = (int) event.getX();
209 int y = (int) event.getY();
210
211 //Log.e("NavitGraphics", "NavitAndroidOverlay -> action=" + action);
212
213 //if (action == MotionEvent.ACTION_UP)
214 //{
215 // Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent ACTION_UP");
216 // if (NavitGraphics.in_map)
217 // {
218 // return false;
219 // }
220 //}
221
222 if (action == MotionEvent.ACTION_DOWN)
223 {
224 if ((this.draw_bubble) && (!confirmed_bubble))
225 {
226 int dx = (int) ((20 / 1.5f) * draw_factor);
227 int dy = (int) ((-100 / 1.5f) * draw_factor);
228 int bubble_size_x = (int) ((150 / 1.5f) * draw_factor);
229 int bubble_size_y = (int) ((60 / 1.5f) * draw_factor);
230 RectF box_rect = new RectF(this.bubble_001.x + dx, this.bubble_001.y + dy, this.bubble_001.x + bubble_size_x + dx, this.bubble_001.y + bubble_size_y + dy);
231 if (box_rect.contains(x, y))
232 {
233 // bubble touched to confirm destination
234 confirmed_bubble = true;
235 // draw confirmed bubble
236 this.postInvalidate();
237 String dest_name = "Point on Screen";
238
239 // remeber recent dest.
240 try
241 {
242 dest_name = NavitGraphics.CallbackGeoCalc(5, this.bubble_001.x, this.bubble_001.y);
243 // System.out.println("x:"+dest_name+":y");
244 if ((dest_name.equals(" ")) || (dest_name == null))
245 {
246 dest_name = "Point on Screen";
247 }
248
249 Navit.remember_destination_xy(dest_name, this.bubble_001.x, this.bubble_001.y);
250 }
251 catch (Exception e)
252 {
253 e.printStackTrace();
254 }
255
256 if (NavitGraphics.navit_route_status == 0)
257 {
258 Navit.destination_set();
259
260 Message msg = new Message();
261 Bundle b = new Bundle();
262 b.putInt("Callback", 4);
263 b.putInt("x", this.bubble_001.x);
264 b.putInt("y", this.bubble_001.y);
265 msg.setData(b);
266 Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
267 }
268 else
269 {
270 Message msg = new Message();
271 Bundle b = new Bundle();
272 b.putInt("Callback", 49);
273 b.putInt("x", this.bubble_001.x);
274 b.putInt("y", this.bubble_001.y);
275 msg.setData(b);
276 Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
277 }
278
279 // try
280 // {
281 // Navit.follow_button_on();
282 // }
283 // catch (Exception e2)
284 // {
285 // e2.printStackTrace();
286 // }
287
288 // consume the event
289 return true;
290 }
291 }
292 }
293
294 if (action == MotionEvent.ACTION_DOWN)
295 {
296 //Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent ACTION_DOWN");
297 if (this.follow_button_rect.contains(x, y))
298 {
299 if (NavitGraphics.in_map)
300 {
301 // toggle follow mode
302 Navit.toggle_follow_button();
303 this.postInvalidate();
304 // consume the event
305 return true;
306 }
307 }
308 else if (this.mapdrawing_button_rect.contains(x, y))
309 {
310 if (NavitGraphics.in_map)
311 {
312 try
313 {
314 Message msg = new Message();
315 Bundle b = new Bundle();
316 if (NavitGraphics.MAP_DISPLAY_OFF)
317 {
318 NavitGraphics.MAP_DISPLAY_OFF = false;
319 b.putInt("Callback", 63);
320 }
321 else
322 {
323 NavitGraphics.MAP_DISPLAY_OFF = true;
324 b.putInt("Callback", 62);
325 }
326 msg.setData(b);
327 Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
328 // redraw map
329 Message msg2 = new Message();
330 Bundle b2 = new Bundle();
331 b2.putInt("Callback", 64);
332 msg2.setData(b2);
333 Navit.N_NavitGraphics.callback_handler.sendMessage(msg2);
334
335 }
336 catch (Exception e)
337 {
338 e.printStackTrace();
339 }
340 // consume the event
341 return true;
342 }
343 }
344 else if (this.zoomin_button_rect.contains(x, y))
345 {
346 if (NavitGraphics.in_map)
347 {
348 try
349 {
350 if (overlay_draw_thread1 == null)
351 {
352 overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
353 overlay_draw_thread1.start();
354 }
355 }
356 catch (Exception e)
357 {
358 overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
359 overlay_draw_thread1.start();
360 }
361
362 // System.out.println("ZZZZZZZZ O.11");
363 // //if (NavitGraphics.wait_for_redraw_map == true)
364 // {
365 // System.out.println("ZZZZZZZZ O.11.A");
366 // // stop drawing the map
367 // try
368 // {
369 // NavitGraphics.CallbackMessageChannel(50, "");
370 // // Message msg = new Message();
371 // // Bundle b = new Bundle();
372 // // b.putInt("Callback", 50);
373 // // msg.setData(b);
374 // // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
375 // }
376 // catch (Exception e)
377 // {
378 // e.printStackTrace();
379 // }
380 // }
381 NavitGraphics.wait_for_redraw_map = true;
382 this.invalidate();
383 //System.out.println("wait_for_redraw_map=true o1");
384 //Log.e("NavitGraphics", "wait_for_redraw_map=true o1");
385 // zoom in
386 try
387 {
388 // NavitGraphics.CallbackMessageChannel(1, "");
389 Message msg = new Message();
390 Bundle b = new Bundle();
391 b.putInt("Callback", 1);
392 msg.setData(b);
393 Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
394 }
395 catch (Exception e)
396 {
397 e.printStackTrace();
398 }
399 // consume the event
400 return true;
401 }
402 }
403 else if (this.zoomout_button_rect.contains(x, y))
404 {
405 if (NavitGraphics.in_map)
406 {
407 try
408 {
409 if (overlay_draw_thread1 == null)
410 {
411 overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
412 overlay_draw_thread1.start();
413 }
414 }
415 catch (Exception e)
416 {
417 overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
418 overlay_draw_thread1.start();
419 }
420
421 // System.out.println("ZZZZZZZZ O.22");
422 // if (NavitGraphics.wait_for_redraw_map == true)
423 // {
424 // System.out.println("ZZZZZZZZ O.22.A");
425 // // stop drawing the map
426 // try
427 // {
428 // NavitGraphics.CallbackMessageChannel(50, "");
429 // // Message msg = new Message();
430 // // Bundle b = new Bundle();
431 // // b.putInt("Callback", 50);
432 // // msg.setData(b);
433 // // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
434 // }
435 // catch (Exception e)
436 // {
437 // e.printStackTrace();
438 // }
439 // }
440
441 try
442 {
443 NavitGraphics.wait_for_redraw_map = true;
444 this.invalidate();
445 //System.out.println("wait_for_redraw_map=true o2");
446 //Log.e("NavitGraphics", "wait_for_redraw_map=true o2");
447 // zoom out
448
449 // NavitGraphics.CallbackMessageChannel(2, "");
450 Message msg = new Message();
451 Bundle b = new Bundle();
452 b.putInt("Callback", 2);
453 msg.setData(b);
454 Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
455 }
456 catch (Exception e)
457 {
458 e.printStackTrace();
459 }
460 // consume the event
461 return true;
462 }
463 }
464 else
465 {
466 try
467 {
468 if (overlay_draw_thread1 == null)
469 {
470 overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
471 overlay_draw_thread1.start();
472 }
473 }
474 catch (Exception e)
475 {
476 overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
477 overlay_draw_thread1.start();
478 }
479 }
480 }
481
482 // test if we touched the grey rectangle
483 //
484 // if ((x < 300) && (x > 10) && (y < 200) && (y > 10))
485 // {
486 // Log.e("Navit", "NavitAndroidOverlay -> onTouchEvent -> touch Rect!!");
487 // return true;
488 // }
489 // else
490 // {
491 // return false;
492 // }
493
494 // false -> we dont use this event, give it to other layers
495 return false;
496 }
497
498 @Override
499 public void onSizeChanged(int w, int h, int oldw, int oldh)
500 {
501 // super.onSizeChanged(w, h, oldw, oldh);
502 this.mCanvasWidth = w;
503 this.mCanvasHeight = h;
504
505 draw_factor = 1.0f;
506 if (Navit.my_display_density.compareTo("mdpi") == 0)
507 {
508 draw_factor = 1.0f;
509 }
510 else if (Navit.my_display_density.compareTo("ldpi") == 0)
511 {
512 draw_factor = 0.7f;
513 }
514 else if (Navit.my_display_density.compareTo("hdpi") == 0)
515 {
516 draw_factor = 1.5f;
517 }
518
519 int w_1 = (int) ((10f / 1.5f) * draw_factor);
520 int h_1 = (int) ((200f / 1.5f) * draw_factor);
521 this.follow_button_rect = new RectF(this.mCanvasWidth - Navit.follow_current.getWidth() - w_1, this.mCanvasHeight - Navit.follow_current.getHeight() - h_1, this.mCanvasWidth - w_1, this.mCanvasHeight - h_1);
522
523 /*
524 * int w_2 = (int) ((0 / 1.5f) * draw_factor) + 5;
525 * int h_2 = (int) ((0f / 1.5f) * draw_factor) + 5;
526 * int h_button_zoom = Navit.zoomin.getHeight();
527 * zoomin_ltx = w_2;
528 * zoomin_lty = h_2;
529 * this.zoomin_button_rect = new RectF(w_2, h_2, Navit.zoomin.getWidth() + w_2, h_button_zoom + h_2);
530 */
531
532 int w_2 = (int) ((0 / 1.5f) * draw_factor) + 5;
533 int h_2 = (int) ((70f / 1.5f) * draw_factor) + 5 + 25;
534 int h_button_zoom = Navit.zoomin.getHeight();
535 zoomin_ltx = w_2;
536 zoomin_lty = h_2;
537 this.zoomin_button_rect = new RectF(w_2, h_2, Navit.zoomin.getWidth() + w_2, h_button_zoom + h_2);
538
539 w_2 = (int) ((0 / 1.5f) * draw_factor) + 5;
540 h_2 = (int) ((2 * 70f / 1.5f) * draw_factor) + 5 + 25 + 25;
541 zoomout_ltx = w_2;
542 zoomout_lty = h_2;
543 this.zoomout_button_rect = new RectF(w_2, h_2, Navit.zoomout.getWidth() + w_2, h_button_zoom + h_2);
544
545 int mapdrawing_width = 75;
546 int mapdrawing_height = 75;
547 w_2 = (int) (((this.mCanvasWidth - mapdrawing_width) / 1.5f) * draw_factor) - 5;
548 h_2 = (int) ((70f / 1.5f) * draw_factor) + 5 + 25;
549 mapdrawing_ltx = w_2;
550 mapdrawing_lty = h_2;
551 this.mapdrawing_button_rect = new RectF(w_2, h_2, mapdrawing_width + w_2, mapdrawing_height + h_2);
552 }
553
554 public void onDraw(Canvas c)
555 {
556 // ************!!!!!!!!!!!!! optimze me !!!!!!!!!!!*************
557 // ************!!!!!!!!!!!!! optimze me !!!!!!!!!!!*************
558 // ************!!!!!!!!!!!!! optimze me !!!!!!!!!!!*************
559 // ************!!!!!!!!!!!!! optimze me !!!!!!!!!!!*************
560 // ************!!!!!!!!!!!!! optimze me !!!!!!!!!!!*************
561 // ************!!!!!!!!!!!!! optimze me !!!!!!!!!!!*************
562
563 //Log.e("NavitGraphics", "NavitAndroidOverlay -> onDraw");
564 //System.out.println("NavitAndroidOverlay -> onDraw");
565
566 if (this.draw_bubble)
567 {
568 if ((System.currentTimeMillis() - this.bubble_showing_since) > bubble_max_showing_timespan)
569 {
570 // bubble has been showing too log, hide it
571 this.hide_bubble();
572
573 // next lines are a hack, without it screen will not get updated anymore!
574 // next lines are a hack, without it screen will not get updated anymore!
575 // down
576 // Message msg = new Message();
577 // Bundle b = new Bundle();
578 // b.putInt("Callback", 21);
579 // b.putInt("x", 1);
580 // b.putInt("y", 1);
581 // msg.setData(b);
582 // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
583 //
584 // // move
585 // msg = new Message();
586 // b = new Bundle();
587 // b.putInt("Callback", 23);
588 // b.putInt("x", 1 + 10);
589 // b.putInt("y", 1);
590 // msg.setData(b);
591 // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
592 //
593 // // move
594 // msg = new Message();
595 // b = new Bundle();
596 // b.putInt("Callback", 23);
597 // b.putInt("x", 1 - 10);
598 // b.putInt("y", 1);
599 // msg.setData(b);
600 // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
601 //
602 // // up
603 // msg = new Message();
604 // b = new Bundle();
605 // b.putInt("Callback", 22);
606 // b.putInt("x", 1);
607 // b.putInt("y", 1);
608 // msg.setData(b);
609 // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
610 // next lines are a hack, without it screen will not get updated anymore!
611 // next lines are a hack, without it screen will not get updated anymore!
612 }
613 }
614
615 if (this.draw_bubble)
616 {
617 //Log.e("Navit", "NavitAndroidOverlay -> onDraw -> bubble");
618
619 int dx = (int) ((20 / 1.5f) * draw_factor);
620 int dy = (int) ((-100 / 1.5f) * draw_factor);
621 Paint bubble_paint = new Paint(0);
622
623 int bubble_size_x = (int) ((150 / 1.5f) * draw_factor);
624 int bubble_size_y = (int) ((60 / 1.5f) * draw_factor);
625
626 // yellow-ish funny lines
627 int lx = (int) ((15 / 1.5f) * draw_factor);
628 int ly = (int) ((15 / 1.5f) * draw_factor);
629 bubble_paint.setStyle(Style.FILL);
630 bubble_paint.setAntiAlias(true);
631 bubble_paint.setStrokeWidth(8 / 1.5f * draw_factor);
632 bubble_paint.setColor(Color.parseColor("#FFF8C6"));
633 c.drawLine(this.bubble_001.x + dx, this.bubble_001.y + dy + bubble_size_y - ly, this.bubble_001.x, this.bubble_001.y, bubble_paint);
634 c.drawLine(this.bubble_001.x + dx + lx, this.bubble_001.y + dy + bubble_size_y, this.bubble_001.x, this.bubble_001.y, bubble_paint);
635
636 // draw black funny lines to target
637 bubble_paint.setStyle(Style.STROKE);
638 bubble_paint.setAntiAlias(true);
639 bubble_paint.setStrokeWidth(3);
640 bubble_paint.setColor(Color.parseColor("#000000"));
641 c.drawLine(this.bubble_001.x + dx, this.bubble_001.y + dy + bubble_size_y - ly, this.bubble_001.x, this.bubble_001.y, bubble_paint);
642 c.drawLine(this.bubble_001.x + dx + lx, this.bubble_001.y + dy + bubble_size_y, this.bubble_001.x, this.bubble_001.y, bubble_paint);
643
644 // filled rect yellow-ish
645 bubble_paint.setStyle(Style.FILL);
646 bubble_paint.setStrokeWidth(0);
647 bubble_paint.setAntiAlias(false);
648 bubble_paint.setColor(Color.parseColor("#FFF8C6"));
649 RectF box_rect = new RectF(this.bubble_001.x + dx, this.bubble_001.y + dy, this.bubble_001.x + bubble_size_x + dx, this.bubble_001.y + bubble_size_y + dy);
650 int rx = (int) (20 / 1.5f * draw_factor);
651 int ry = (int) (20 / 1.5f * draw_factor);
652 c.drawRoundRect(box_rect, rx, ry, bubble_paint);
653
654 if (NavitAndroidOverlay.confirmed_bubble)
655 {
656 // filled red rect (for confirmed bubble)
657 //bubble_paint.setStyle(Style.FILL);
658 //bubble_paint.setStrokeWidth(0);
659 //bubble_paint.setAntiAlias(false);
660 bubble_paint.setColor(Color.parseColor("#EC294D"));
661 c.drawRoundRect(box_rect, rx, ry, bubble_paint);
662 }
663
664 // black outlined rect
665 bubble_paint.setStyle(Style.STROKE);
666 bubble_paint.setStrokeWidth(3);
667 bubble_paint.setAntiAlias(true);
668 bubble_paint.setColor(Color.parseColor("#000000"));
669 c.drawRoundRect(box_rect, rx, ry, bubble_paint);
670
671 int inner_dx = (int) (30 / 1.5f * draw_factor);
672 int inner_dy = (int) (36 / 1.5f * draw_factor);
673 bubble_paint.setAntiAlias(true);
674 bubble_paint.setStyle(Style.FILL);
675 bubble_paint.setTextSize((int) (20 / 1.5f * draw_factor));
676 bubble_paint.setStrokeWidth(3);
677 bubble_paint.setColor(Color.parseColor("#3b3131"));
678 c.drawText(Navit.get_text("drive here"), this.bubble_001.x + dx + inner_dx, this.bubble_001.y + dy + inner_dy, bubble_paint);
679
680 }
681
682 if (NavitGraphics.in_map)
683 {
684 // draw follow
685 if (Navit.follow_current != null)
686 {
687 c.drawBitmap(Navit.follow_current, this.follow_button_rect.left, this.follow_button_rect.top, null);
688 }
689 }
690
691 if (NavitGraphics.in_map)
692 {
693 c.drawBitmap(Navit.zoomin, zoomin_ltx, zoomin_lty, null);
694 c.drawBitmap(Navit.zoomout, zoomout_ltx, zoomout_lty, null);
695 Paint paint = new Paint();
696 paint.setAntiAlias(true);
697 paint.setStyle(Style.STROKE);
698 paint.setColor(Color.GRAY);
699 paint.setAlpha(30);
700 paint.setStrokeWidth(2);
701 c.drawRoundRect(this.zoomin_button_rect, 10, 10, paint);
702 //paint.setStyle(Style.STROKE);
703 //paint.setColor(Color.GRAY);
704 //paint.setAlpha(30);
705 c.drawRoundRect(this.zoomout_button_rect, 10, 10, paint);
706 c.drawRoundRect(this.mapdrawing_button_rect, 10, 10, paint);
707 paint.setStrokeWidth(10);
708 paint.setAlpha(80);
709 c.drawLine(this.mapdrawing_button_rect.left + 10, this.mapdrawing_button_rect.bottom - 10, this.mapdrawing_button_rect.right - 10, this.mapdrawing_button_rect.top + 10, paint);
710 }
711
712 if (NavitGraphics.in_map)
713 {
714 //Log.e("NavitGraphics", "NavitAndroidOverlay -> draw2");
715 if (NavitGraphics.wait_for_redraw_map)
716 {
717 //Log.e("NavitGraphics", "NavitAndroidOverlay -> draw wait rect");
718 Paint paint = new Paint(0);
719 paint.setAntiAlias(true);
720 paint.setStyle(Style.FILL);
721 paint.setColor(Color.LTGRAY);
722 paint.setAlpha(70);
723
724 RectF r1 = new RectF(20 * draw_factor, 20 * draw_factor, this.mCanvasWidth - 20 * draw_factor, this.mCanvasHeight - 20 * draw_factor);
725 c.drawRoundRect(r1, 20, 20, paint);
726 paint.setColor(Color.parseColor("#888888"));
727 paint.setAlpha(230);
728 paint.setTextAlign(Paint.Align.CENTER);
729 paint.setStrokeWidth(2);
730 paint.setTextSize(30);
731 c.drawText(Navit.get_text("wait ..."), this.mCanvasWidth / 2, this.mCanvasHeight / 2, paint); //TRANS
732 }
733 }
734
735 // // test, draw rectangles on top layer!
736 // Paint paint = new Paint(0);
737 // paint.setAntiAlias(false);
738 // paint.setStyle(Style.STROKE);
739 // paint.setColor(Color.GREEN);
740 // c.drawRect(0 * draw_factor, 0 * draw_factor, 64 * draw_factor, 64 * draw_factor, paint);
741 // paint.setColor(Color.RED);
742 // c.drawRect(0 * draw_factor, (0 + 70) * draw_factor, 64 * draw_factor,
743 // (64 + 70) * draw_factor, paint);
744 }
745 }

   
Visit the ZANavi Wiki