/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java
ViewVC logotype

Contents of /android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 916 - (show annotations) (download)
Sat Jun 26 10:47:52 2010 UTC (13 years, 10 months ago) by torben
File size: 2893 byte(s)
Dont request features before oncreate is called
1 package dk.thoerup.traininfo;
2
3 import android.app.Activity;
4 import android.content.Intent;
5 import android.net.Uri;
6 import android.os.Bundle;
7 import android.os.Handler;
8 import android.os.Message;
9 import android.view.View;
10 import android.view.Window;
11 import android.view.View.OnClickListener;
12 import android.widget.Button;
13
14 import com.nullwire.trace.ExceptionHandler;
15
16 import dk.thoerup.checkupdates.CheckUpdates;
17
18 public class WelcomeScreen extends Activity{
19 public enum ListType {
20 ListNearest,
21 ListSearch,
22 ListFavorites
23 }
24
25 Handler handler = new Handler();
26
27 @Override
28 public void onCreate(Bundle savedInstanceState) {
29
30 super.onCreate(savedInstanceState);
31 requestWindowFeature( Window.FEATURE_NO_TITLE );
32 setContentView(R.layout.welcome);
33
34 Button nearestButton = (Button) findViewById(R.id.nearest);
35 nearestButton.setOnClickListener( new StationListListener(ListType.ListNearest));
36
37 Button searchButton = (Button) findViewById(R.id.search);
38 searchButton.setOnClickListener( new StationListListener(ListType.ListSearch));
39
40 Button favoritesButton = (Button) findViewById(R.id.favorites);
41 favoritesButton.setOnClickListener( new StationListListener(ListType.ListFavorites));
42
43 Button aboutButton = (Button) findViewById(R.id.about);
44 aboutButton.setOnClickListener( new AboutListener() );
45
46 ExceptionHandler.register(this, "http://t-hoerup.dk/android/trace.php");
47
48 CheckUpdates update = new CheckUpdates();
49 update.checkForUpdates(this, "http://t-hoerup.dk/android/traininfo/version.txt", "TrainInfo DK", null);
50 /*
51 Runnable r = new Runnable() {
52 @Override
53 public void run() {
54 View splash = findViewById(R.id.splash);
55 splash.setVisibility(View.GONE);
56 }
57 };
58 handler.postDelayed(r, 1500);
59 */
60 }
61
62 class AboutListener implements OnClickListener {
63
64 @Override
65 public void onClick(View v) {
66 /*
67 String appName = WelcomeScreen.this.getResources().getString(R.string.app_name);
68 String ver = WelcomeScreen.this.getResources().getString(R.string.app_version);
69
70 StringBuffer message = new StringBuffer();
71 message.append(appName);
72 message.append(" v").append(ver).append("\n");
73 message.append("By Torben H. Nielsen\n");
74
75 MessageBox.showMessage(WelcomeScreen.this, message.toString());*/
76 Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.t-hoerup.dk/android/traininfo/"));
77 startActivity(browserIntent);
78 }
79
80 }
81
82 class StationListListener implements OnClickListener{
83 ListType launchType;
84 StationListListener(ListType type) {
85 launchType = type;
86 }
87
88 @Override
89 public void onClick(View v) {
90 Intent intent = new Intent(WelcomeScreen.this, StationList.class);
91 intent.putExtra("type", launchType);
92 WelcomeScreen.this.startActivity(intent);
93 }
94
95 }
96 }

  ViewVC Help
Powered by ViewVC 1.1.20