/[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 481 - (show annotations) (download)
Thu Oct 29 08:56:17 2009 UTC (14 years, 6 months ago) by torben
File size: 1575 byte(s)
New gui structure with a initial welcome screen
1 package dk.thoerup.traininfo;
2
3 import android.app.Activity;
4 import android.content.Intent;
5 import android.os.Bundle;
6 import android.view.View;
7 import android.view.View.OnClickListener;
8 import android.widget.Button;
9
10 public class WelcomeScreen extends Activity{
11 public enum ListType {
12 ListNearest,
13 ListSearch,
14 ListFavorites
15 }
16
17 @Override
18 public void onCreate(Bundle savedInstanceState) {
19 super.onCreate(savedInstanceState);
20 setContentView(R.layout.welcome);
21
22 Button nearestButton = (Button) findViewById(R.id.nearest);
23 nearestButton.setOnClickListener( new StationListListener(ListType.ListNearest));
24
25 Button searchButton = (Button) findViewById(R.id.search);
26 searchButton.setOnClickListener( new StationListListener(ListType.ListSearch));
27
28 Button favoritesButton = (Button) findViewById(R.id.favorites);
29 favoritesButton.setOnClickListener( new StationListListener(ListType.ListFavorites));
30
31 Button aboutButton = (Button) findViewById(R.id.about);
32 aboutButton.setOnClickListener( new AboutListener() );
33
34 }
35
36 class AboutListener implements OnClickListener {
37
38 @Override
39 public void onClick(View v) {
40
41 }
42
43 }
44
45 class StationListListener implements OnClickListener{
46 ListType launchType;
47 StationListListener(ListType type) {
48 launchType = type;
49 }
50
51 @Override
52 public void onClick(View v) {
53 Intent intent = new Intent(WelcomeScreen.this, StationList.class);
54 intent.putExtra("type", launchType);
55 WelcomeScreen.this.startActivity(intent);
56 }
57
58 }
59 }

  ViewVC Help
Powered by ViewVC 1.1.20