1 | package org.mapsforge.android.maps;
|
---|
2 |
|
---|
3 | import org.greenstone.android.tipple.TippleActivity;
|
---|
4 |
|
---|
5 | import android.app.AlertDialog;
|
---|
6 | import android.content.Context;
|
---|
7 | import android.graphics.drawable.Drawable;
|
---|
8 | import android.speech.tts.TextToSpeech;
|
---|
9 |
|
---|
10 | public class ArrayItemizedTextAudioOverlay extends ArrayItemizedOverlayTweaked
|
---|
11 | {
|
---|
12 | protected final TextToSpeech tts_;
|
---|
13 | protected AlertDialog dialogAlert;
|
---|
14 |
|
---|
15 | public ArrayItemizedTextAudioOverlay(Drawable defaultMarker, Context context, TextToSpeech tts)
|
---|
16 | {
|
---|
17 | super(defaultMarker,context);
|
---|
18 | tts_ = tts;
|
---|
19 | }
|
---|
20 |
|
---|
21 | @Override
|
---|
22 | public synchronized boolean onTap(int index) {
|
---|
23 | this.item = this.overlayItems.get(index);
|
---|
24 | this.dialog = new AlertDialog.Builder(this.context);
|
---|
25 | this.dialog.setTitle(this.item.getTitle());
|
---|
26 | this.dialog.setMessage(this.item.getSnippet());
|
---|
27 | dialogAlert = this.dialog.show();
|
---|
28 |
|
---|
29 | TippleActivity.log.optMessage("Manual Location Tap", "Title: " + item.getTitle());
|
---|
30 |
|
---|
31 | //OverlayTextAudioItem ta_item = (OverlayTextAudioItem)this.overlayItems.get(index);
|
---|
32 | //tts_.speak(ta_item.getTitle(), TextToSpeech.QUEUE_FLUSH, null);
|
---|
33 | //tts_.speak(ta_item.getTTSSnippet(), TextToSpeech.QUEUE_ADD, null);
|
---|
34 |
|
---|
35 | return true;
|
---|
36 | }
|
---|
37 |
|
---|
38 | public synchronized boolean unTap() {
|
---|
39 |
|
---|
40 | dialogAlert.cancel();
|
---|
41 | tts_.stop();
|
---|
42 | return true;
|
---|
43 | }
|
---|
44 | }
|
---|
45 |
|
---|