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 |
|
---|
37 |
|
---|
38 | public class NetworkedTippleActivity extends TippleActivity
|
---|
39 | {
|
---|
40 |
|
---|
41 | @Override
|
---|
42 | protected void onCreate(Bundle savedInstanceState)
|
---|
43 | {
|
---|
44 | System.err.println("*** TippleActivity::onCreate()");
|
---|
45 | super.onCreate(savedInstanceState);
|
---|
46 |
|
---|
47 | if (!initTippleStore()) {
|
---|
48 | System.err.println("Failed to initialize TippleStore on sdcard. Quiting");
|
---|
49 | onDestroy();
|
---|
50 | }
|
---|
51 |
|
---|
52 | // Set up logging
|
---|
53 | log = new TippleLog(this,logDirectory);
|
---|
54 | log.optStartLog();
|
---|
55 |
|
---|
56 | // "refresh" preferences here so views can be configured correctly
|
---|
57 | // and ensure showUserTrail is reset to off (as not log file has been selected yet)
|
---|
58 | refreshPreferences();
|
---|
59 | SharedPreferences.Editor editor = sharedPreferences.edit();
|
---|
60 | editor.putBoolean("showUserTrail",false);
|
---|
61 |
|
---|
62 | // Set up Text to Speech
|
---|
63 | Intent checkIntent = new Intent();
|
---|
64 | checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
|
---|
65 | startActivityForResult(checkIntent, TTS_DATA_CHECK);
|
---|
66 |
|
---|
67 | //startActivityForResult(new Intent(this, LogFileBrowser.class), SELECT_LOG_FILE);
|
---|
68 |
|
---|
69 |
|
---|
70 | // Screen dived into:
|
---|
71 | // Top: GPS location
|
---|
72 | // Bottom: Media player
|
---|
73 |
|
---|
74 | LinearLayout linearLayout = new LinearLayout(this);
|
---|
75 | linearLayout.setOrientation(LinearLayout.VERTICAL);
|
---|
76 |
|
---|
77 | longlat_view_ = createLongLatView();
|
---|
78 | map_view_ = createMapView("new-zealand.map");
|
---|
79 |
|
---|
80 | text_view_ = createTextView();
|
---|
81 | text_map_composite_ = compositTextViewOnMapView(map_view_,text_view_);
|
---|
82 |
|
---|
83 | audio_player_view_ = createAudioPlayerView();
|
---|
84 |
|
---|
85 | linearLayout.addView(longlat_view_);
|
---|
86 | linearLayout.addView(text_map_composite_);
|
---|
87 | linearLayout.addView(audio_player_view_);
|
---|
88 |
|
---|
89 | setContentView(linearLayout);
|
---|
90 | }
|
---|
91 |
|
---|
92 |
|
---|
93 | } |
---|