/[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 568 - (show annotations) (download)
Fri Jan 29 05:44:09 2010 UTC (14 years, 3 months ago) by torben
File size: 2376 byte(s)
Version 0.6.1 

Added stacktrace postback library
1 package dk.thoerup.traininfo;
2
3 import com.nullwire.trace.ExceptionHandler;
4
5 import android.app.Activity;
6 import android.content.Intent;
7 import android.net.Uri;
8 import android.os.Bundle;
9 import android.view.View;
10 import android.view.Window;
11 import android.view.View.OnClickListener;
12 import android.widget.Button;
13
14 public class WelcomeScreen extends Activity{
15 public enum ListType {
16 ListNearest,
17 ListSearch,
18 ListFavorites
19 }
20
21 @Override
22 public void onCreate(Bundle savedInstanceState) {
23 requestWindowFeature( Window.FEATURE_NO_TITLE );
24 super.onCreate(savedInstanceState);
25 setContentView(R.layout.welcome);
26
27 Button nearestButton = (Button) findViewById(R.id.nearest);
28 nearestButton.setOnClickListener( new StationListListener(ListType.ListNearest));
29
30 Button searchButton = (Button) findViewById(R.id.search);
31 searchButton.setOnClickListener( new StationListListener(ListType.ListSearch));
32
33 Button favoritesButton = (Button) findViewById(R.id.favorites);
34 favoritesButton.setOnClickListener( new StationListListener(ListType.ListFavorites));
35
36 Button aboutButton = (Button) findViewById(R.id.about);
37 aboutButton.setOnClickListener( new AboutListener() );
38
39 ExceptionHandler.register(this, "http://t-hoerup.dk/android/trace.php");
40 }
41
42 class AboutListener implements OnClickListener {
43
44 @Override
45 public void onClick(View v) {
46 /*
47 String appName = WelcomeScreen.this.getResources().getString(R.string.app_name);
48 String ver = WelcomeScreen.this.getResources().getString(R.string.app_version);
49
50 StringBuffer message = new StringBuffer();
51 message.append(appName);
52 message.append(" v").append(ver).append("\n");
53 message.append("By Torben H. Nielsen\n");
54
55 MessageBox.showMessage(WelcomeScreen.this, message.toString());*/
56 Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.t-hoerup.dk/android/traininfo/"));
57 startActivity(browserIntent);
58 }
59
60 }
61
62 class StationListListener implements OnClickListener{
63 ListType launchType;
64 StationListListener(ListType type) {
65 launchType = type;
66 }
67
68 @Override
69 public void onClick(View v) {
70 Intent intent = new Intent(WelcomeScreen.this, StationList.class);
71 intent.putExtra("type", launchType);
72 WelcomeScreen.this.startActivity(intent);
73 }
74
75 }
76 }

  ViewVC Help
Powered by ViewVC 1.1.20