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 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent");
|
190 |
super.onTouchEvent(event);
|
191 |
|
192 |
int action = event.getAction();
|
193 |
int x = (int) event.getX();
|
194 |
int y = (int) event.getY();
|
195 |
|
196 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> action=" + action);
|
197 |
|
198 |
//if (action == MotionEvent.ACTION_UP)
|
199 |
//{
|
200 |
// Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent ACTION_UP");
|
201 |
// if (NavitGraphics.in_map)
|
202 |
// {
|
203 |
// return false;
|
204 |
// }
|
205 |
//}
|
206 |
|
207 |
if (action == MotionEvent.ACTION_DOWN)
|
208 |
{
|
209 |
if ((this.draw_bubble) && (!this.confirmed_bubble))
|
210 |
{
|
211 |
int dx = (int) ((20 / 1.5f) * draw_factor);
|
212 |
int dy = (int) ((-100 / 1.5f) * draw_factor);
|
213 |
int bubble_size_x = (int) ((150 / 1.5f) * draw_factor);
|
214 |
int bubble_size_y = (int) ((60 / 1.5f) * draw_factor);
|
215 |
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);
|
216 |
if (box_rect.contains(x, y))
|
217 |
{
|
218 |
// bubble touched to confirm destination
|
219 |
this.confirmed_bubble = true;
|
220 |
// draw confirmed bubble
|
221 |
this.postInvalidate();
|
222 |
|
223 |
// set destination
|
224 |
Message msg = new Message();
|
225 |
Bundle b = new Bundle();
|
226 |
b.putInt("Callback", 4);
|
227 |
b.putInt("x", this.bubble_001.x);
|
228 |
b.putInt("y", this.bubble_001.y);
|
229 |
msg.setData(b);
|
230 |
Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
231 |
|
232 |
// try
|
233 |
// {
|
234 |
// Navit.follow_button_on();
|
235 |
// }
|
236 |
// catch (Exception e2)
|
237 |
// {
|
238 |
// e2.printStackTrace();
|
239 |
// }
|
240 |
|
241 |
// consume the event
|
242 |
return true;
|
243 |
}
|
244 |
}
|
245 |
}
|
246 |
|
247 |
if (action == MotionEvent.ACTION_DOWN)
|
248 |
{
|
249 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> onTouchEvent ACTION_DOWN");
|
250 |
if (this.follow_button_rect.contains(x, y))
|
251 |
{
|
252 |
if (NavitGraphics.in_map)
|
253 |
{
|
254 |
// toggle follow mode
|
255 |
Navit.toggle_follow_button();
|
256 |
this.postInvalidate();
|
257 |
// consume the event
|
258 |
return true;
|
259 |
}
|
260 |
}
|
261 |
else if (this.zoomin_button_rect.contains(x, y))
|
262 |
{
|
263 |
if (NavitGraphics.in_map)
|
264 |
{
|
265 |
try
|
266 |
{
|
267 |
if (overlay_draw_thread1 == null)
|
268 |
{
|
269 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
270 |
overlay_draw_thread1.start();
|
271 |
}
|
272 |
}
|
273 |
catch (Exception e)
|
274 |
{
|
275 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
276 |
overlay_draw_thread1.start();
|
277 |
}
|
278 |
|
279 |
NavitGraphics.wait_for_redraw_map = true;
|
280 |
this.invalidate();
|
281 |
//System.out.println("wait_for_redraw_map=true o1");
|
282 |
//Log.e("NavitGraphics", "wait_for_redraw_map=true o1");
|
283 |
// zoom in
|
284 |
try
|
285 |
{
|
286 |
Message msg = new Message();
|
287 |
Bundle b = new Bundle();
|
288 |
b.putInt("Callback", 1);
|
289 |
msg.setData(b);
|
290 |
Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
291 |
}
|
292 |
catch (Exception e)
|
293 |
{
|
294 |
e.printStackTrace();
|
295 |
}
|
296 |
// consume the event
|
297 |
return true;
|
298 |
}
|
299 |
}
|
300 |
else if (this.zoomout_button_rect.contains(x, y))
|
301 |
{
|
302 |
if (NavitGraphics.in_map)
|
303 |
{
|
304 |
try
|
305 |
{
|
306 |
if (overlay_draw_thread1 == null)
|
307 |
{
|
308 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
309 |
overlay_draw_thread1.start();
|
310 |
}
|
311 |
}
|
312 |
catch (Exception e)
|
313 |
{
|
314 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
315 |
overlay_draw_thread1.start();
|
316 |
}
|
317 |
|
318 |
try
|
319 |
{
|
320 |
NavitGraphics.wait_for_redraw_map = true;
|
321 |
this.invalidate();
|
322 |
//System.out.println("wait_for_redraw_map=true o2");
|
323 |
//Log.e("NavitGraphics", "wait_for_redraw_map=true o2");
|
324 |
// zoom out
|
325 |
Message msg = new Message();
|
326 |
Bundle b = new Bundle();
|
327 |
b.putInt("Callback", 2);
|
328 |
msg.setData(b);
|
329 |
Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
330 |
}
|
331 |
catch (Exception e)
|
332 |
{
|
333 |
e.printStackTrace();
|
334 |
}
|
335 |
// consume the event
|
336 |
return true;
|
337 |
}
|
338 |
}
|
339 |
else
|
340 |
{
|
341 |
try
|
342 |
{
|
343 |
if (overlay_draw_thread1 == null)
|
344 |
{
|
345 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
346 |
overlay_draw_thread1.start();
|
347 |
}
|
348 |
}
|
349 |
catch (Exception e)
|
350 |
{
|
351 |
overlay_draw_thread1 = new NavitGraphics.OverlayDrawThread();
|
352 |
overlay_draw_thread1.start();
|
353 |
}
|
354 |
}
|
355 |
}
|
356 |
|
357 |
// test if we touched the grey rectangle
|
358 |
//
|
359 |
// if ((x < 300) && (x > 10) && (y < 200) && (y > 10))
|
360 |
// {
|
361 |
// Log.e("Navit", "NavitAndroidOverlay -> onTouchEvent -> touch Rect!!");
|
362 |
// return true;
|
363 |
// }
|
364 |
// else
|
365 |
// {
|
366 |
// return false;
|
367 |
// }
|
368 |
|
369 |
// false -> we dont use this event, give it to other layers
|
370 |
return false;
|
371 |
}
|
372 |
|
373 |
@Override
|
374 |
public void onSizeChanged(int w, int h, int oldw, int oldh)
|
375 |
{
|
376 |
// super.onSizeChanged(w, h, oldw, oldh);
|
377 |
this.mCanvasWidth = w;
|
378 |
this.mCanvasHeight = h;
|
379 |
|
380 |
draw_factor = 1.0f;
|
381 |
if (Navit.my_display_density.compareTo("mdpi") == 0)
|
382 |
{
|
383 |
draw_factor = 1.0f;
|
384 |
}
|
385 |
else if (Navit.my_display_density.compareTo("ldpi") == 0)
|
386 |
{
|
387 |
draw_factor = 0.7f;
|
388 |
}
|
389 |
else if (Navit.my_display_density.compareTo("hdpi") == 0)
|
390 |
{
|
391 |
draw_factor = 1.5f;
|
392 |
}
|
393 |
|
394 |
int w_1 = (int) ((10f / 1.5f) * draw_factor);
|
395 |
int h_1 = (int) ((200f / 1.5f) * draw_factor);
|
396 |
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);
|
397 |
|
398 |
int w_2 = (int) ((0 / 1.5f) * draw_factor) + 5;
|
399 |
int h_2 = (int) ((0f / 1.5f) * draw_factor) + 5;
|
400 |
int h_button_zoom = Navit.zoomin.getHeight();
|
401 |
zoomin_ltx = w_2;
|
402 |
zoomin_lty = h_2;
|
403 |
this.zoomin_button_rect = new RectF(w_2, h_2, Navit.zoomin.getWidth() + w_2, h_button_zoom + h_2);
|
404 |
w_2 = (int) ((0 / 1.5f) * draw_factor) + 5;
|
405 |
h_2 = (int) ((70f / 1.5f) * draw_factor) + 5 + 25;
|
406 |
zoomout_ltx = w_2;
|
407 |
zoomout_lty = h_2;
|
408 |
this.zoomout_button_rect = new RectF(w_2, h_2, Navit.zoomout.getWidth() + w_2, h_button_zoom + h_2);
|
409 |
|
410 |
}
|
411 |
|
412 |
public void onDraw(Canvas c)
|
413 |
{
|
414 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> onDraw");
|
415 |
//System.out.println("NavitAndroidOverlay -> onDraw");
|
416 |
|
417 |
if (this.draw_bubble)
|
418 |
{
|
419 |
if ((System.currentTimeMillis() - this.bubble_showing_since) > this.bubble_max_showing_timespan)
|
420 |
{
|
421 |
// bubble has been showing too log, hide it
|
422 |
this.hide_bubble();
|
423 |
|
424 |
// next lines are a hack, without it screen will not get updated anymore!
|
425 |
// next lines are a hack, without it screen will not get updated anymore!
|
426 |
// down
|
427 |
// Message msg = new Message();
|
428 |
// Bundle b = new Bundle();
|
429 |
// b.putInt("Callback", 21);
|
430 |
// b.putInt("x", 1);
|
431 |
// b.putInt("y", 1);
|
432 |
// msg.setData(b);
|
433 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
434 |
//
|
435 |
// // move
|
436 |
// msg = new Message();
|
437 |
// b = new Bundle();
|
438 |
// b.putInt("Callback", 23);
|
439 |
// b.putInt("x", 1 + 10);
|
440 |
// b.putInt("y", 1);
|
441 |
// msg.setData(b);
|
442 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
443 |
//
|
444 |
// // move
|
445 |
// msg = new Message();
|
446 |
// b = new Bundle();
|
447 |
// b.putInt("Callback", 23);
|
448 |
// b.putInt("x", 1 - 10);
|
449 |
// b.putInt("y", 1);
|
450 |
// msg.setData(b);
|
451 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
452 |
//
|
453 |
// // up
|
454 |
// msg = new Message();
|
455 |
// b = new Bundle();
|
456 |
// b.putInt("Callback", 22);
|
457 |
// b.putInt("x", 1);
|
458 |
// b.putInt("y", 1);
|
459 |
// msg.setData(b);
|
460 |
// Navit.N_NavitGraphics.callback_handler.sendMessage(msg);
|
461 |
// next lines are a hack, without it screen will not get updated anymore!
|
462 |
// next lines are a hack, without it screen will not get updated anymore!
|
463 |
}
|
464 |
}
|
465 |
|
466 |
if (this.draw_bubble)
|
467 |
{
|
468 |
//Log.e("Navit", "NavitAndroidOverlay -> onDraw -> bubble");
|
469 |
|
470 |
int dx = (int) ((20 / 1.5f) * draw_factor);
|
471 |
int dy = (int) ((-100 / 1.5f) * draw_factor);
|
472 |
Paint bubble_paint = new Paint(0);
|
473 |
|
474 |
int bubble_size_x = (int) ((150 / 1.5f) * draw_factor);
|
475 |
int bubble_size_y = (int) ((60 / 1.5f) * draw_factor);
|
476 |
|
477 |
// yellow-ish funny lines
|
478 |
int lx = (int) ((15 / 1.5f) * draw_factor);
|
479 |
int ly = (int) ((15 / 1.5f) * draw_factor);
|
480 |
bubble_paint.setStyle(Style.FILL);
|
481 |
bubble_paint.setAntiAlias(true);
|
482 |
bubble_paint.setStrokeWidth(8 / 1.5f * draw_factor);
|
483 |
bubble_paint.setColor(Color.parseColor("#FFF8C6"));
|
484 |
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);
|
485 |
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);
|
486 |
|
487 |
// draw black funny lines to target
|
488 |
bubble_paint.setStyle(Style.STROKE);
|
489 |
bubble_paint.setAntiAlias(true);
|
490 |
bubble_paint.setStrokeWidth(3);
|
491 |
bubble_paint.setColor(Color.parseColor("#000000"));
|
492 |
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);
|
493 |
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);
|
494 |
|
495 |
// filled rect yellow-ish
|
496 |
bubble_paint.setStyle(Style.FILL);
|
497 |
bubble_paint.setStrokeWidth(0);
|
498 |
bubble_paint.setAntiAlias(false);
|
499 |
bubble_paint.setColor(Color.parseColor("#FFF8C6"));
|
500 |
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);
|
501 |
int rx = (int) (20 / 1.5f * draw_factor);
|
502 |
int ry = (int) (20 / 1.5f * draw_factor);
|
503 |
c.drawRoundRect(box_rect, rx, ry, bubble_paint);
|
504 |
|
505 |
if (NavitAndroidOverlay.confirmed_bubble)
|
506 |
{
|
507 |
// filled red rect (for confirmed bubble)
|
508 |
//bubble_paint.setStyle(Style.FILL);
|
509 |
//bubble_paint.setStrokeWidth(0);
|
510 |
//bubble_paint.setAntiAlias(false);
|
511 |
bubble_paint.setColor(Color.parseColor("#EC294D"));
|
512 |
c.drawRoundRect(box_rect, rx, ry, bubble_paint);
|
513 |
}
|
514 |
|
515 |
// black outlined rect
|
516 |
bubble_paint.setStyle(Style.STROKE);
|
517 |
bubble_paint.setStrokeWidth(3);
|
518 |
bubble_paint.setAntiAlias(true);
|
519 |
bubble_paint.setColor(Color.parseColor("#000000"));
|
520 |
c.drawRoundRect(box_rect, rx, ry, bubble_paint);
|
521 |
|
522 |
int inner_dx = (int) (30 / 1.5f * draw_factor);
|
523 |
int inner_dy = (int) (36 / 1.5f * draw_factor);
|
524 |
bubble_paint.setAntiAlias(true);
|
525 |
bubble_paint.setStyle(Style.FILL);
|
526 |
bubble_paint.setTextSize((int) (20 / 1.5f * draw_factor));
|
527 |
bubble_paint.setStrokeWidth(3);
|
528 |
bubble_paint.setColor(Color.parseColor("#3b3131"));
|
529 |
c.drawText(Navit.get_text("drive here"), this.bubble_001.x + dx + inner_dx, this.bubble_001.y + dy + inner_dy, bubble_paint);
|
530 |
|
531 |
}
|
532 |
|
533 |
if (NavitGraphics.in_map)
|
534 |
{
|
535 |
// draw follow
|
536 |
if (Navit.follow_current != null)
|
537 |
{
|
538 |
c.drawBitmap(Navit.follow_current, this.follow_button_rect.left, this.follow_button_rect.top, null);
|
539 |
}
|
540 |
}
|
541 |
|
542 |
if (NavitGraphics.in_map)
|
543 |
{
|
544 |
c.drawBitmap(Navit.zoomin, zoomin_ltx, zoomin_lty, null);
|
545 |
c.drawBitmap(Navit.zoomout, zoomout_ltx, zoomout_lty, null);
|
546 |
Paint paint = new Paint();
|
547 |
paint.setAntiAlias(true);
|
548 |
paint.setStyle(Style.STROKE);
|
549 |
paint.setColor(Color.GRAY);
|
550 |
paint.setAlpha(30);
|
551 |
c.drawRoundRect((RectF) this.zoomin_button_rect, 10, 10, paint);
|
552 |
//paint.setStyle(Style.STROKE);
|
553 |
//paint.setColor(Color.GRAY);
|
554 |
//paint.setAlpha(30);
|
555 |
c.drawRoundRect((RectF) this.zoomout_button_rect, 10, 10, paint);
|
556 |
}
|
557 |
|
558 |
if (NavitGraphics.in_map)
|
559 |
{
|
560 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> draw2");
|
561 |
if (NavitGraphics.wait_for_redraw_map)
|
562 |
{
|
563 |
//Log.e("NavitGraphics", "NavitAndroidOverlay -> draw wait rect");
|
564 |
Paint paint = new Paint(0);
|
565 |
paint.setAntiAlias(true);
|
566 |
paint.setStyle(Style.FILL);
|
567 |
paint.setColor(Color.LTGRAY);
|
568 |
paint.setAlpha(70);
|
569 |
|
570 |
RectF r1 = new RectF(20 * draw_factor, 20 * draw_factor, this.mCanvasWidth - 20 * draw_factor, this.mCanvasHeight - 20 * draw_factor);
|
571 |
c.drawRoundRect(r1, 20, 20, paint);
|
572 |
paint.setColor(Color.parseColor("#888888"));
|
573 |
paint.setAlpha(230);
|
574 |
paint.setTextAlign(Paint.Align.CENTER);
|
575 |
paint.setStrokeWidth(2);
|
576 |
paint.setTextSize(30);
|
577 |
c.drawText(Navit.get_text("wait ..."), this.mCanvasWidth / 2, this.mCanvasHeight / 2, paint); //TRANS
|
578 |
}
|
579 |
}
|
580 |
|
581 |
// // test, draw rectangles on top layer!
|
582 |
// Paint paint = new Paint(0);
|
583 |
// paint.setAntiAlias(false);
|
584 |
// paint.setStyle(Style.STROKE);
|
585 |
// paint.setColor(Color.GREEN);
|
586 |
// c.drawRect(0 * draw_factor, 0 * draw_factor, 64 * draw_factor, 64 * draw_factor, paint);
|
587 |
// paint.setColor(Color.RED);
|
588 |
// c.drawRect(0 * draw_factor, (0 + 70) * draw_factor, 64 * draw_factor,
|
589 |
// (64 + 70) * draw_factor, paint);
|
590 |
}
|
591 |
}
|