source: other-projects/tipple-android/tipple-ar/tipple-standalone-hpg/src/org/mapsforge/android/maps/ArrayItemizedTextAudioOverlay.java@ 26528

Last change on this file since 26528 was 26528, checked in by davidb, 11 years ago

Code developed by the Tipple-AR Smoke and Mirrors team, based on the main tipple trunk

File size: 1.7 KB
Line 
1package org.mapsforge.android.maps;
2
3import org.greenstone.android.tipple.base.TippleActivity;
4
5import android.app.AlertDialog;
6import android.content.Context;
7import android.content.DialogInterface;
8import android.content.DialogInterface.OnCancelListener;
9import android.graphics.drawable.Drawable;
10import android.speech.tts.TextToSpeech;
11
12public class ArrayItemizedTextAudioOverlay extends ArrayItemizedOverlayTweaked
13{
14 protected final TextToSpeech tts_;
15 protected AlertDialog dialogAlert;
16
17 public ArrayItemizedTextAudioOverlay(Drawable defaultMarker, Context context, TextToSpeech tts)
18 {
19 super(defaultMarker,context);
20 tts_ = tts;
21 }
22
23 @Override
24 public synchronized boolean onTap(int index) {
25 this.item = this.overlayItems.get(index);
26 this.dialog = new AlertDialog.Builder(this.context);
27 this.dialog.setTitle(this.item.getTitle());
28 this.dialog.setMessage(this.item.getSnippet());
29
30 this.dialog.setOnCancelListener(new OnCancelListener() {
31
32 @Override
33 public void onCancel(DialogInterface dialog) {
34 tts_.stop();
35 }
36 });
37
38 dialogAlert = this.dialog.show();
39
40 TippleActivity.log.optMessage("Manual Location Tap", "Title: " + item.getTitle());
41
42 OverlayTextAudioItem ta_item = (OverlayTextAudioItem)this.overlayItems.get(index);
43 tts_.speak(ta_item.getTTSTitle(), TextToSpeech.QUEUE_FLUSH, null);
44 tts_.speak(ta_item.getTTSSnippet(), TextToSpeech.QUEUE_ADD, null);
45
46 return true;
47 }
48
49 public synchronized boolean unTap() {
50
51 dialogAlert.cancel();
52 tts_.stop();
53 return true;
54 }
55
56 /* public synchronized boolean onBackPressed() {
57
58 dialogAlert.cancel();
59 tts_.stop();
60
61 return true;
62 } */
63}
64
Note: See TracBrowser for help on using the repository browser.