/[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 483 - (show annotations) (download)
Thu Oct 29 10:49:14 2009 UTC (14 years, 6 months ago) by torben
File size: 2003 byte(s)
AboutBox, fixed title, and show a seperate icon if a train is cancelled
1 package dk.thoerup.traininfo;
2
3 import dk.thoerup.traininfo.util.MessageBox;
4 import android.app.Activity;
5 import android.content.Intent;
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 ver = WelcomeScreen.this.getResources().getString(R.string.app_version);
44 StringBuffer message = new StringBuffer();
45 message.append("TrainInfo DK v").append(ver).append("\n");
46 message.append("By Torben H. Nielsen\n");
47
48 MessageBox.showMessage(WelcomeScreen.this, message.toString());
49 }
50
51 }
52
53 class StationListListener implements OnClickListener{
54 ListType launchType;
55 StationListListener(ListType type) {
56 launchType = type;
57 }
58
59 @Override
60 public void onClick(View v) {
61 Intent intent = new Intent(WelcomeScreen.this, StationList.class);
62 intent.putExtra("type", launchType);
63 WelcomeScreen.this.startActivity(intent);
64 }
65
66 }
67 }

  ViewVC Help
Powered by ViewVC 1.1.20