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 static int zoomin_ltx = 0;
|
62 |
public static int zoomin_lty = 0;
|
63 |
public static int zoomout_ltx = 0;
|
64 |
public static int zoomout_lty = 0;
|
65 |
public int mCanvasHeight = 1;
|
66 |
public int mCanvasWidth = 1;
|
67 |
public static float draw_factor = 1.0f;
|
68 |
|
69 |
public static BubbleThread bubble_thread = null;
|
70 |
|
71 |
public static NavitGraphics.OverlayDrawThread overlay_draw_thread1;
|
72 |
|
73 |
private class BubbleThread extends Thread
|
74 |
{
|
75 |
private Boolean running;
|
76 |
private long bubble_showing_since = 0L;
|
77 |
private NavitAndroidOverlay a_overlay = null;
|
78 |
|
79 |
BubbleThread(NavitAndroidOverlay a_ov)
|
80 |
{
|
81 |
this.running = true;
|
82 |
this.a_overlay = a_ov;
|
83 |
this.bubble_showing_since = System.currentTimeMillis();
|
84 |
//Log.e("Navit", "BubbleThread created");
|
85 |
}
|
86 |
|
87 |
public void stop_me()
|
88 |
{
|
89 |
this.running = false;
|
90 |
}
|
91 |
|
92 |
public void run()
|
93 |
{
|
94 |
//Log.e("Navit", "BubbleThread started");
|
95 |
while (this.running)
|
96 |
{
|
97 |
if ((System.currentTimeMillis() - this.bubble_showing_since) > bubble_max_showing_timespan)
|
98 |
{
|
99 |
//Log.e("Navit", "BubbleThread: bubble displaying too long, hide it");
|
100 |
// with invalidate we call the onDraw() function, that will take care of it
|
101 |
this.a_overlay.postInvalidate();
|
102 |
this.running = false;
|
103 |
}
|
104 |
else
|
105 |
{
|
106 |
try
|
107 |
{
|
108 |
Thread.sleep(50);
|
109 |
}
|
110 |
catch (InterruptedException e)
|
111 |
{
|
112 |
// e.printStackTrace();
|
113 |
}
|
114 |
}
|
115 |
}
|
116 |
//Log.e("Navit", "BubbleThread ended");
|
117 |
}
|
118 |
}
|
119 |
|
120 |
public static class NavitAndroidOverlayBubble
|
121 |
{
|
122 |
int x;
|
123 |
int y;
|
124 |
String text = null;
|
125 |
}
|
126 |
|
127 |
private NavitAndroidOverlayBubble bubble_001 = null;
|
128 |
|
129 |
public NavitAndroidOverlay(Context context)
|
130 |
{
|
131 |
super(context);
|
132 |
}
|
133 |
|
134 |
public void show_bubble()
|
135 |
{
|
136 |
//Log.e("Navit", "NavitAndroidOverlay -> show_bubble");
|
137 |
if (!this.draw_bubble)
|
138 |
{
|
139 |
this.confirmed_bubble = false;
|
140 |
this.draw_bubble = true;
|
141 |
this.bubble_showing_since = System.currentTimeMillis();
|
142 |
bubble_thread = new BubbleThread(this);
|
143 |
bubble_thread.start();
|
144 |
|
145 |
// test test DEBUG
|
146 |
/*
|
147 |
* Message msg = new Message();
|
148 |
* Bundle b = new Bundle();
|
149 |
* b.putInt("Callback", 4);
|
150 |
* b.putInt("x", this.bubble_001.x);
|
151 |
* b.putInt("y", this.bubble_001.y);
|
152 |
* msg.setData(b);
|
153 |
* Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
154 |
*/
|
155 |
}
|
156 |
}
|
157 |
|
158 |
public Boolean get_show_bubble()
|
159 |
{
|
160 |
return this.draw_bubble;
|
161 |
}
|
162 |
|
163 |
public void hide_bubble()
|
164 |
{
|
165 |
// Log.e("NavitGraphics", "NavitAndroidOverlay -> hide_bubble");
|
166 |
this.confirmed_bubble = false;
|
167 |
this.draw_bubble = false;
|
168 |
this.bubble_showing_since = 0L;
|
169 |
try
|
170 |
{
|
171 |
bubble_thread.stop_me();
|
172 |
// bubble_thread.stop();
|
173 |
}
|
174 |
catch (Exception e)
|
175 |
{
|
176 |
|
177 |
}
|
178 |
//this.postInvalidate();
|
179 |
}
|
180 |
|
181 |
public void set_bubble(NavitAndroidOverlayBubble b)
|
182 |
{
|
183 |
this.bubble_001 = b;
|
184 |
}
|
185 |
|
186 |
@Override
|
187 |
public boolean onTouchEvent(MotionEvent event)
|
188 |
{
|
189 |
//if (NavitGraphics.wait_for_redraw_map == true)
|
190 |
//{
|
191 |
// Log.e("NavitGraphics", "GD NavitAndroidOverlay GD -> onTouchEvent");
|
192 |
// Message msg = new Message();
|
193 |
// Bundle b = new Bundle();
|
194 |
// b.putInt("Callback", 50);
|
195 |
// msg.setData(b);
|
196 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
197 |
//}
|
198 |
//else
|
199 |
//{
|
200 |
// // Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent");
|
201 |
//}
|
202 |
super.onTouchEvent(event);
|
203 |
|
204 |
int action = event.getAction();
|
205 |
int x = (int) event.getX();
|
206 |
int y = (int) event.getY();
|
207 |
|
208 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> action=" + action);
|
209 |
|
210 |
//if (action == MotionEvent.ACTION_UP)
|
211 |
//{
|
212 |
// Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent ACTION_UP");
|
213 |
// if (NavitGraphics.in_map)
|
214 |
// {
|
215 |
// return false;
|
216 |
// }
|
217 |
//}
|
218 |
|
219 |
if (action == MotionEvent.ACTION_DOWN)
|
220 |
{
|
221 |
if ((this.draw_bubble) && (!this.confirmed_bubble))
|
222 |
{
|
223 |
int dx = (int) ((20 / 1.5f) * draw_factor);
|
224 |
int dy = (int) ((-100 / 1.5f) * draw_factor);
|
225 |
int bubble_size_x = (int) ((150 / 1.5f) * draw_factor);
|
226 |
int bubble_size_y = (int) ((60 / 1.5f) * draw_factor);
|
227 |
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);
|
228 |
if (box_rect.contains(x, y))
|
229 |
{
|
230 |
// bubble touched to confirm destination
|
231 |
this.confirmed_bubble = true;
|
232 |
// draw confirmed bubble
|
233 |
this.postInvalidate();
|
234 |
|
235 |
// remeber recent dest.
|
236 |
try
|
237 |
{
|
238 |
Navit.remember_destination_xy("Point on Screen", this.bubble_001.x, this.bubble_001.y);
|
239 |
}
|
240 |
catch (Exception e)
|
241 |
{
|
242 |
e.printStackTrace();
|
243 |
}
|
244 |
|
245 |
if (NavitGraphics.navit_route_status == 0)
|
246 |
{
|
247 |
Navit.destination_set();
|
248 |
|
249 |
Message msg = new Message();
|
250 |
Bundle b = new Bundle();
|
251 |
b.putInt("Callback", 4);
|
252 |
b.putInt("x", this.bubble_001.x);
|
253 |
b.putInt("y", this.bubble_001.y);
|
254 |
msg.setData(b);
|
255 |
Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
256 |
}
|
257 |
else
|
258 |
{
|
259 |
Message msg = new Message();
|
260 |
Bundle b = new Bundle();
|
261 |
b.putInt("Callback", 49);
|
262 |
b.putInt("x", this.bubble_001.x);
|
263 |
b.putInt("y", this.bubble_001.y);
|
264 |
msg.setData(b);
|
265 |
Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
266 |
}
|
267 |
|
268 |
// try
|
269 |
// {
|
270 |
// Navit.follow_button_on();
|
271 |
// }
|
272 |
// catch (Exception e2)
|
273 |
// {
|
274 |
// e2.printStackTrace();
|
275 |
// }
|
276 |
|
277 |
// consume the event
|
278 |
return true;
|
279 |
}
|
280 |
}
|
281 |
}
|
282 |
|
283 |
if (action == MotionEvent.ACTION_DOWN)
|
284 |
{
|
285 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent ACTION_DOWN");
|
286 |
if (this.follow_button_rect.contains(x, y))
|
287 |
{
|
288 |
if (NavitGraphics.in_map)
|
289 |
{
|
290 |
// toggle follow mode
|
291 |
Navit.toggle_follow_button();
|
292 |
this.postInvalidate();
|
293 |
// consume the event
|
294 |
return true;
|
295 |
}
|
296 |
}
|
297 |
else if (this.zoomin_button_rect.contains(x, y))
|
298 |
{
|
299 |
if (NavitGraphics.in_map)
|
300 |
{
|
301 |
try
|
302 |
{
|
303 |
if (overlay_draw_thread1 == null)
|
304 |
{
|
305 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
306 |
overlay_draw_thread1.start();
|
307 |
}
|
308 |
}
|
309 |
catch (Exception e)
|
310 |
{
|
311 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
312 |
overlay_draw_thread1.start();
|
313 |
}
|
314 |
|
315 |
// System.out.println("ZZZZZZZZ O.11");
|
316 |
// //if (NavitGraphics.wait_for_redraw_map == true)
|
317 |
// {
|
318 |
// System.out.println("ZZZZZZZZ O.11.A");
|
319 |
// // stop drawing the map
|
320 |
// try
|
321 |
// {
|
322 |
// NavitGraphics.CallbackMessageChannel(50, "");
|
323 |
// // Message msg = new Message();
|
324 |
// // Bundle b = new Bundle();
|
325 |
// // b.putInt("Callback", 50);
|
326 |
// // msg.setData(b);
|
327 |
// // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
328 |
// }
|
329 |
// catch (Exception e)
|
330 |
// {
|
331 |
// e.printStackTrace();
|
332 |
// }
|
333 |
// }
|
334 |
NavitGraphics.wait_for_redraw_map = true;
|
335 |
this.invalidate();
|
336 |
//System.out.println("wait_for_redraw_map=true o1");
|
337 |
//Log.e("NavitGraphics", "wait_for_redraw_map=true o1");
|
338 |
// zoom in
|
339 |
try
|
340 |
{
|
341 |
// NavitGraphics.CallbackMessageChannel(1, "");
|
342 |
Message msg = new Message();
|
343 |
Bundle b = new Bundle();
|
344 |
b.putInt("Callback", 1);
|
345 |
msg.setData(b);
|
346 |
Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
347 |
}
|
348 |
catch (Exception e)
|
349 |
{
|
350 |
e.printStackTrace();
|
351 |
}
|
352 |
// consume the event
|
353 |
return true;
|
354 |
}
|
355 |
}
|
356 |
else if (this.zoomout_button_rect.contains(x, y))
|
357 |
{
|
358 |
if (NavitGraphics.in_map)
|
359 |
{
|
360 |
try
|
361 |
{
|
362 |
if (overlay_draw_thread1 == null)
|
363 |
{
|
364 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
365 |
overlay_draw_thread1.start();
|
366 |
}
|
367 |
}
|
368 |
catch (Exception e)
|
369 |
{
|
370 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
371 |
overlay_draw_thread1.start();
|
372 |
}
|
373 |
|
374 |
// System.out.println("ZZZZZZZZ O.22");
|
375 |
// if (NavitGraphics.wait_for_redraw_map == true)
|
376 |
// {
|
377 |
// System.out.println("ZZZZZZZZ O.22.A");
|
378 |
// // stop drawing the map
|
379 |
// try
|
380 |
// {
|
381 |
// NavitGraphics.CallbackMessageChannel(50, "");
|
382 |
// // Message msg = new Message();
|
383 |
// // Bundle b = new Bundle();
|
384 |
// // b.putInt("Callback", 50);
|
385 |
// // msg.setData(b);
|
386 |
// // Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
387 |
// }
|
388 |
// catch (Exception e)
|
389 |
// {
|
390 |
// e.printStackTrace();
|
391 |
// }
|
392 |
// }
|
393 |
|
394 |
try
|
395 |
{
|
396 |
NavitGraphics.wait_for_redraw_map = true;
|
397 |
this.invalidate();
|
398 |
//System.out.println("wait_for_redraw_map=true o2");
|
399 |
//Log.e("NavitGraphics", "wait_for_redraw_map=true o2");
|
400 |
// zoom out
|
401 |
|
402 |
// NavitGraphics.CallbackMessageChannel(2, "");
|
403 |
Message msg = new Message();
|
404 |
Bundle b = new Bundle();
|
405 |
b.putInt("Callback", 2);
|
406 |
msg.setData(b);
|
407 |
Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
408 |
}
|
409 |
catch (Exception e)
|
410 |
{
|
411 |
e.printStackTrace();
|
412 |
}
|
413 |
// consume the event
|
414 |
return true;
|
415 |
}
|
416 |
}
|
417 |
else
|
418 |
{
|
419 |
try
|
420 |
{
|
421 |
if (overlay_draw_thread1 == null)
|
422 |
{
|
423 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
424 |
overlay_draw_thread1.start();
|
425 |
}
|
426 |
}
|
427 |
catch (Exception e)
|
428 |
{
|
429 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
430 |
overlay_draw_thread1.start();
|
431 |
}
|
432 |
}
|
433 |
}
|
434 |
|
435 |
// test if we touched the grey rectangle
|
436 |
//
|
437 |
// if ((x < 300) && (x > 10) && (y < 200) && (y > 10))
|
438 |
// {
|
439 |
// Log.e("Navit", "NavitAndroidOverlay -> onTouchEvent -> touch Rect!!");
|
440 |
// return true;
|
441 |
// }
|
442 |
// else
|
443 |
// {
|
444 |
// return false;
|
445 |
// }
|
446 |
|
447 |
// false -> we dont use this event, give it to other layers
|
448 |
return false;
|
449 |
}
|
450 |
|
451 |
@Override
|
452 |
public void onSizeChanged(int w, int h, int oldw, int oldh)
|
453 |
{
|
454 |
// super.onSizeChanged(w, h, oldw, oldh);
|
455 |
this.mCanvasWidth = w;
|
456 |
this.mCanvasHeight = h;
|
457 |
|
458 |
draw_factor = 1.0f;
|
459 |
if (Navit.my_display_density.compareTo("mdpi") == 0)
|
460 |
{
|
461 |
draw_factor = 1.0f;
|
462 |
}
|
463 |
else if (Navit.my_display_density.compareTo("ldpi") == 0)
|
464 |
{
|
465 |
draw_factor = 0.7f;
|
466 |
}
|
467 |
else if (Navit.my_display_density.compareTo("hdpi") == 0)
|
468 |
{
|
469 |
draw_factor = 1.5f;
|
470 |
}
|
471 |
|
472 |
int w_1 = (int) ((10f / 1.5f) * draw_factor);
|
473 |
int h_1 = (int) ((200f / 1.5f) * draw_factor);
|
474 |
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);
|
475 |
|
476 |
int w_2 = (int) ((0 / 1.5f) * draw_factor) + 5;
|
477 |
int h_2 = (int) ((0f / 1.5f) * draw_factor) + 5;
|
478 |
int h_button_zoom = Navit.zoomin.getHeight();
|
479 |
zoomin_ltx = w_2;
|
480 |
zoomin_lty = h_2;
|
481 |
this.zoomin_button_rect = new RectF(w_2, h_2, Navit.zoomin.getWidth() + w_2, h_button_zoom + h_2);
|
482 |
w_2 = (int) ((0 / 1.5f) * draw_factor) + 5;
|
483 |
h_2 = (int) ((70f / 1.5f) * draw_factor) + 5 + 25;
|
484 |
zoomout_ltx = w_2;
|
485 |
zoomout_lty = h_2;
|
486 |
this.zoomout_button_rect = new RectF(w_2, h_2, Navit.zoomout.getWidth() + w_2, h_button_zoom + h_2);
|
487 |
|
488 |
}
|
489 |
|
490 |
public void onDraw(Canvas c)
|
491 |
{
|
492 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> onDraw");
|
493 |
//System.out.println("NavitAndroidOverlay -> onDraw");
|
494 |
|
495 |
if (this.draw_bubble)
|
496 |
{
|
497 |
if ((System.currentTimeMillis() - this.bubble_showing_since) > this.bubble_max_showing_timespan)
|
498 |
{
|
499 |
// bubble has been showing too log, hide it
|
500 |
this.hide_bubble();
|
501 |
|
502 |
// next lines are a hack, without it screen will not get updated anymore!
|
503 |
// next lines are a hack, without it screen will not get updated anymore!
|
504 |
// down
|
505 |
// Message msg = new Message();
|
506 |
// Bundle b = new Bundle();
|
507 |
// b.putInt("Callback", 21);
|
508 |
// b.putInt("x", 1);
|
509 |
// b.putInt("y", 1);
|
510 |
// msg.setData(b);
|
511 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
512 |
//
|
513 |
// // move
|
514 |
// msg = new Message();
|
515 |
// b = new Bundle();
|
516 |
// b.putInt("Callback", 23);
|
517 |
// b.putInt("x", 1 + 10);
|
518 |
// b.putInt("y", 1);
|
519 |
// msg.setData(b);
|
520 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
521 |
//
|
522 |
// // move
|
523 |
// msg = new Message();
|
524 |
// b = new Bundle();
|
525 |
// b.putInt("Callback", 23);
|
526 |
// b.putInt("x", 1 - 10);
|
527 |
// b.putInt("y", 1);
|
528 |
// msg.setData(b);
|
529 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
530 |
//
|
531 |
// // up
|
532 |
// msg = new Message();
|
533 |
// b = new Bundle();
|
534 |
// b.putInt("Callback", 22);
|
535 |
// b.putInt("x", 1);
|
536 |
// b.putInt("y", 1);
|
537 |
// msg.setData(b);
|
538 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
539 |
// next lines are a hack, without it screen will not get updated anymore!
|
540 |
// next lines are a hack, without it screen will not get updated anymore!
|
541 |
}
|
542 |
}
|
543 |
|
544 |
if (this.draw_bubble)
|
545 |
{
|
546 |
//Log.e("Navit", "NavitAndroidOverlay -> onDraw -> bubble");
|
547 |
|
548 |
int dx = (int) ((20 / 1.5f) * draw_factor);
|
549 |
int dy = (int) ((-100 / 1.5f) * draw_factor);
|
550 |
Paint bubble_paint = new Paint(0);
|
551 |
|
552 |
int bubble_size_x = (int) ((150 / 1.5f) * draw_factor);
|
553 |
int bubble_size_y = (int) ((60 / 1.5f) * draw_factor);
|
554 |
|
555 |
// yellow-ish funny lines
|
556 |
int lx = (int) ((15 / 1.5f) * draw_factor);
|
557 |
int ly = (int) ((15 / 1.5f) * draw_factor);
|
558 |
bubble_paint.setStyle(Style.FILL);
|
559 |
bubble_paint.setAntiAlias(true);
|
560 |
bubble_paint.setStrokeWidth(8 / 1.5f * draw_factor);
|
561 |
bubble_paint.setColor(Color.parseColor("#FFF8C6"));
|
562 |
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);
|
563 |
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);
|
564 |
|
565 |
// draw black funny lines to target
|
566 |
bubble_paint.setStyle(Style.STROKE);
|
567 |
bubble_paint.setAntiAlias(true);
|
568 |
bubble_paint.setStrokeWidth(3);
|
569 |
bubble_paint.setColor(Color.parseColor("#000000"));
|
570 |
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);
|
571 |
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);
|
572 |
|
573 |
// filled rect yellow-ish
|
574 |
bubble_paint.setStyle(Style.FILL);
|
575 |
bubble_paint.setStrokeWidth(0);
|
576 |
bubble_paint.setAntiAlias(false);
|
577 |
bubble_paint.setColor(Color.parseColor("#FFF8C6"));
|
578 |
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);
|
579 |
int rx = (int) (20 / 1.5f * draw_factor);
|
580 |
int ry = (int) (20 / 1.5f * draw_factor);
|
581 |
c.drawRoundRect(box_rect, rx, ry, bubble_paint);
|
582 |
|
583 |
if (NavitAndroidOverlay.confirmed_bubble)
|
584 |
{
|
585 |
// filled red rect (for confirmed bubble)
|
586 |
//bubble_paint.setStyle(Style.FILL);
|
587 |
//bubble_paint.setStrokeWidth(0);
|
588 |
//bubble_paint.setAntiAlias(false);
|
589 |
bubble_paint.setColor(Color.parseColor("#EC294D"));
|
590 |
c.drawRoundRect(box_rect, rx, ry, bubble_paint);
|
591 |
}
|
592 |
|
593 |
// black outlined rect
|
594 |
bubble_paint.setStyle(Style.STROKE);
|
595 |
bubble_paint.setStrokeWidth(3);
|
596 |
bubble_paint.setAntiAlias(true);
|
597 |
bubble_paint.setColor(Color.parseColor("#000000"));
|
598 |
c.drawRoundRect(box_rect, rx, ry, bubble_paint);
|
599 |
|
600 |
int inner_dx = (int) (30 / 1.5f * draw_factor);
|
601 |
int inner_dy = (int) (36 / 1.5f * draw_factor);
|
602 |
bubble_paint.setAntiAlias(true);
|
603 |
bubble_paint.setStyle(Style.FILL);
|
604 |
bubble_paint.setTextSize((int) (20 / 1.5f * draw_factor));
|
605 |
bubble_paint.setStrokeWidth(3);
|
606 |
bubble_paint.setColor(Color.parseColor("#3b3131"));
|
607 |
c.drawText(Navit.get_text("drive here"), this.bubble_001.x + dx + inner_dx, this.bubble_001.y + dy + inner_dy, bubble_paint);
|
608 |
|
609 |
}
|
610 |
|
611 |
if (NavitGraphics.in_map)
|
612 |
{
|
613 |
// draw follow
|
614 |
if (Navit.follow_current != null)
|
615 |
{
|
616 |
c.drawBitmap(Navit.follow_current, this.follow_button_rect.left, this.follow_button_rect.top, null);
|
617 |
}
|
618 |
}
|
619 |
|
620 |
if (NavitGraphics.in_map)
|
621 |
{
|
622 |
c.drawBitmap(Navit.zoomin, zoomin_ltx, zoomin_lty, null);
|
623 |
c.drawBitmap(Navit.zoomout, zoomout_ltx, zoomout_lty, null);
|
624 |
Paint paint = new Paint();
|
625 |
paint.setAntiAlias(true);
|
626 |
paint.setStyle(Style.STROKE);
|
627 |
paint.setColor(Color.GRAY);
|
628 |
paint.setAlpha(30);
|
629 |
c.drawRoundRect((RectF) this.zoomin_button_rect, 10, 10, paint);
|
630 |
//paint.setStyle(Style.STROKE);
|
631 |
//paint.setColor(Color.GRAY);
|
632 |
//paint.setAlpha(30);
|
633 |
c.drawRoundRect((RectF) this.zoomout_button_rect, 10, 10, paint);
|
634 |
}
|
635 |
|
636 |
if (NavitGraphics.in_map)
|
637 |
{
|
638 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> draw2");
|
639 |
if (NavitGraphics.wait_for_redraw_map)
|
640 |
{
|
641 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> draw wait rect");
|
642 |
Paint paint = new Paint(0);
|
643 |
paint.setAntiAlias(true);
|
644 |
paint.setStyle(Style.FILL);
|
645 |
paint.setColor(Color.LTGRAY);
|
646 |
paint.setAlpha(70);
|
647 |
|
648 |
RectF r1 = new RectF(20 * draw_factor, 20 * draw_factor, this.mCanvasWidth - 20 * draw_factor, this.mCanvasHeight - 20 * draw_factor);
|
649 |
c.drawRoundRect(r1, 20, 20, paint);
|
650 |
paint.setColor(Color.parseColor("#888888"));
|
651 |
paint.setAlpha(230);
|
652 |
paint.setTextAlign(Paint.Align.CENTER);
|
653 |
paint.setStrokeWidth(2);
|
654 |
paint.setTextSize(30);
|
655 |
c.drawText(Navit.get_text("wait ..."), this.mCanvasWidth / 2, this.mCanvasHeight / 2, paint); //TRANS
|
656 |
}
|
657 |
}
|
658 |
|
659 |
// // test, draw rectangles on top layer!
|
660 |
// Paint paint = new Paint(0);
|
661 |
// paint.setAntiAlias(false);
|
662 |
// paint.setStyle(Style.STROKE);
|
663 |
// paint.setColor(Color.GREEN);
|
664 |
// c.drawRect(0 * draw_factor, 0 * draw_factor, 64 * draw_factor, 64 * draw_factor, paint);
|
665 |
// paint.setColor(Color.RED);
|
666 |
// c.drawRect(0 * draw_factor, (0 + 70) * draw_factor, 64 * draw_factor,
|
667 |
// (64 + 70) * draw_factor, paint);
|
668 |
}
|
669 |
}
|