/[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 500 - (show annotations) (download)
Thu Nov 12 10:03:22 2009 UTC (14 years, 6 months ago) by torben
File size: 2249 byte(s)
Bump to 0.5.2
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.view.View;
8 import android.view.Window;
9 import android.view.View.OnClickListener;
10 import android.widget.Button;
11
12 public class WelcomeScreen extends Activity{
13 public enum ListType {
14 ListNearest,
15 ListSearch,
16 ListFavorites
17 }
18
19 @Override
20 public void onCreate(Bundle savedInstanceState) {
21 requestWindowFeature( Window.FEATURE_NO_TITLE );
22 super.onCreate(savedInstanceState);
23 setContentView(R.layout.welcome);
24
25 Button nearestButton = (Button) findViewById(R.id.nearest);
26 nearestButton.setOnClickListener( new StationListListener(ListType.ListNearest));
27
28 Button searchButton = (Button) findViewById(R.id.search);
29 searchButton.setOnClickListener( new StationListListener(ListType.ListSearch));
30
31 Button favoritesButton = (Button) findViewById(R.id.favorites);
32 favoritesButton.setOnClickListener( new StationListListener(ListType.ListFavorites));
33
34 Button aboutButton = (Button) findViewById(R.id.about);
35 aboutButton.setOnClickListener( new AboutListener() );
36 }
37
38 class AboutListener implements OnClickListener {
39
40 @Override
41 public void onClick(View v) {
42 /*
43 String appName = WelcomeScreen.this.getResources().getString(R.string.app_name);
44 String ver = WelcomeScreen.this.getResources().getString(R.string.app_version);
45
46 StringBuffer message = new StringBuffer();
47 message.append(appName);
48 message.append(" v").append(ver).append("\n");
49 message.append("By Torben H. Nielsen\n");
50
51 MessageBox.showMessage(WelcomeScreen.this, message.toString());*/
52 Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.t-hoerup.dk/android/traininfo/"));
53 startActivity(browserIntent);
54 }
55
56 }
57
58 class StationListListener implements OnClickListener{
59 ListType launchType;
60 StationListListener(ListType type) {
61 launchType = type;
62 }
63
64 @Override
65 public void onClick(View v) {
66 Intent intent = new Intent(WelcomeScreen.this, StationList.class);
67 intent.putExtra("type", launchType);
68 WelcomeScreen.this.startActivity(intent);
69 }
70
71 }
72 }

  ViewVC Help
Powered by ViewVC 1.1.20