1 | package org.mapsforge.android.maps;
|
---|
2 |
|
---|
3 | import android.app.AlertDialog;
|
---|
4 | import android.app.AlertDialog.Builder;
|
---|
5 | import android.content.Context;
|
---|
6 | import android.graphics.drawable.Drawable;
|
---|
7 | import android.speech.tts.TextToSpeech;
|
---|
8 |
|
---|
9 | public class ArrayItemizedTextAudioOverlay extends ArrayItemizedOverlayTweaked {
|
---|
10 | protected final TextToSpeech tts_;
|
---|
11 | protected AlertDialog dialogAlert;
|
---|
12 | protected Drawable marker;
|
---|
13 |
|
---|
14 | public ArrayItemizedTextAudioOverlay(Drawable defaultMarker,
|
---|
15 | Context context, TextToSpeech tts) {
|
---|
16 | super(defaultMarker, context);
|
---|
17 | tts_ = tts;
|
---|
18 | }
|
---|
19 |
|
---|
20 | public ArrayItemizedTextAudioOverlay(Drawable defaultMarker, Context context) {
|
---|
21 | super(defaultMarker, context);
|
---|
22 | tts_ = null;
|
---|
23 | }
|
---|
24 |
|
---|
25 | /*
|
---|
26 | * 21 -03 try to change the marker next need to override the method
|
---|
27 | * "drawonOvermap" --option 2
|
---|
28 | */
|
---|
29 | public void setMarker(Drawable marker) {
|
---|
30 | this.marker = boundCenterBottom(marker);
|
---|
31 | }
|
---|
32 |
|
---|
33 | public Drawable getMarker() {
|
---|
34 | return this.marker;
|
---|
35 | }
|
---|
36 |
|
---|
37 | @Override
|
---|
38 | public synchronized boolean onTap(int index) {
|
---|
39 | this.item = this.overlayItems.get(index);
|
---|
40 | // this.dialog = new AlertDialog.Builder(this.context);
|
---|
41 | // this.dialog.setTitle(this.item.getTitle());
|
---|
42 | // this.dialog.setMessage(this.item.getSnippet());
|
---|
43 | // dialogAlert = this.dialog.show();
|
---|
44 | //
|
---|
45 | // return true;
|
---|
46 |
|
---|
47 | // OverlayItem item = createItem(index);
|
---|
48 | if (item != null) {
|
---|
49 | // System.out.println("ArrayItemizedTextAudioOverlay ontap");
|
---|
50 | Builder builder = new AlertDialog.Builder(this.context);
|
---|
51 | // builder.setIcon(android.R.drawable.ic_menu_info_details);
|
---|
52 | builder.setTitle(item.getTitle());
|
---|
53 | builder.setMessage(item.getSnippet());
|
---|
54 | builder.setPositiveButton("OK", null);
|
---|
55 | builder.show();
|
---|
56 | }
|
---|
57 | return true;
|
---|
58 |
|
---|
59 | }
|
---|
60 |
|
---|
61 | public synchronized boolean unTap() {
|
---|
62 |
|
---|
63 | // dialogAlert.cancel();
|
---|
64 | // tts_.stop();
|
---|
65 | return true;
|
---|
66 | }
|
---|
67 | }
|
---|