1 | package org.greenstone.android.tipple;
|
---|
2 |
|
---|
3 | import java.io.DataOutputStream;
|
---|
4 | import java.io.File;
|
---|
5 | import java.io.FileOutputStream;
|
---|
6 | import java.io.IOException;
|
---|
7 | import java.io.InputStream;
|
---|
8 | import java.util.ArrayList;
|
---|
9 | import java.util.Locale;
|
---|
10 |
|
---|
11 | import android.location.LocationManager;
|
---|
12 | import android.os.Bundle;
|
---|
13 | import android.os.Environment;
|
---|
14 | import android.preference.PreferenceManager;
|
---|
15 | import android.speech.tts.TextToSpeech;
|
---|
16 | import android.speech.tts.TextToSpeech.OnInitListener;
|
---|
17 | import android.text.method.ScrollingMovementMethod;
|
---|
18 | import android.util.Log;
|
---|
19 | import android.view.Gravity;
|
---|
20 | import android.view.Menu;
|
---|
21 | import android.view.MenuItem;
|
---|
22 | import android.view.View;
|
---|
23 | import android.view.ViewGroup;
|
---|
24 | import android.content.Context;
|
---|
25 | import android.content.Intent;
|
---|
26 | import android.content.SharedPreferences;
|
---|
27 | import android.content.res.AssetManager;
|
---|
28 | import android.location.LocationListener;
|
---|
29 | import android.widget.FrameLayout;
|
---|
30 | import android.widget.LinearLayout;
|
---|
31 | import android.widget.LinearLayout.LayoutParams;
|
---|
32 | import android.widget.TextView;
|
---|
33 |
|
---|
34 | import org.greenstone.android.tipple.base.TippleActivity;
|
---|
35 | import org.greenstone.android.tipple.base.TippleLog;
|
---|
36 | import org.mapsforge.android.maps.MapActivity;
|
---|
37 | import org.mapsforge.android.maps.MapView;
|
---|
38 |
|
---|
39 |
|
---|
40 | public class StandaloneTippleActivity extends TippleActivity
|
---|
41 | {
|
---|
42 |
|
---|
43 |
|
---|
44 | @Override
|
---|
45 | protected void onCreate(Bundle savedInstanceState)
|
---|
46 | {
|
---|
47 | System.err.println("*** TippleActivity::onCreate()");
|
---|
48 | super.onCreate(savedInstanceState);
|
---|
49 |
|
---|
50 | if (!initTippleStore("hamilton")) {
|
---|
51 | System.err.println("Failed to initialize TippleStore on sdcard. Quiting");
|
---|
52 | onDestroy();
|
---|
53 | }
|
---|
54 |
|
---|
55 | // Set up logging
|
---|
56 | log = new TippleLog(this,logDirectory);
|
---|
57 | log.optStartLog();
|
---|
58 |
|
---|
59 | // "refresh" preferences here so views can be configured correctly
|
---|
60 | // and ensure showUserTrail is reset to off (as not log file has been selected yet)
|
---|
61 | refreshPreferences();
|
---|
62 | SharedPreferences.Editor editor = sharedPreferences.edit();
|
---|
63 | editor.putBoolean("showUserTrail",false);
|
---|
64 |
|
---|
65 | // Set up Text to Speech
|
---|
66 | Intent checkIntent = new Intent();
|
---|
67 | checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
|
---|
68 | startActivityForResult(checkIntent, TTS_DATA_CHECK);
|
---|
69 |
|
---|
70 | //startActivityForResult(new Intent(this, LogFileBrowser.class), SELECT_LOG_FILE);
|
---|
71 |
|
---|
72 |
|
---|
73 | // Screen dived into:
|
---|
74 | // Top: GPS location
|
---|
75 | // Middle: Map view
|
---|
76 | // Bottom: Media player
|
---|
77 |
|
---|
78 | LinearLayout linearLayout = new LinearLayout(this);
|
---|
79 | linearLayout.setOrientation(LinearLayout.VERTICAL);
|
---|
80 |
|
---|
81 | longlat_view_ = createLongLatView();
|
---|
82 | //map_view_ = createMapView("new-zealand.map");
|
---|
83 | map_view_ = createMapViewFromAsset("hamilton.map");
|
---|
84 |
|
---|
85 | text_view_ = createTextView();
|
---|
86 | text_map_composite_ = compositTextViewOnMapView(map_view_,text_view_);
|
---|
87 |
|
---|
88 | audio_player_view_ = createAudioPlayerView();
|
---|
89 |
|
---|
90 | linearLayout.addView(longlat_view_);
|
---|
91 | linearLayout.addView(text_map_composite_);
|
---|
92 | linearLayout.addView(audio_player_view_);
|
---|
93 |
|
---|
94 | setContentView(linearLayout);
|
---|
95 | }
|
---|
96 |
|
---|
97 |
|
---|
98 |
|
---|
99 | } |
---|