1 |
torben |
481 |
package dk.thoerup.traininfo;
|
2 |
|
|
|
3 |
|
|
import android.app.Activity;
|
4 |
|
|
import android.content.Intent;
|
5 |
torben |
500 |
import android.net.Uri;
|
6 |
torben |
481 |
import android.os.Bundle;
|
7 |
|
|
import android.view.View;
|
8 |
torben |
482 |
import android.view.Window;
|
9 |
torben |
481 |
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 |
torben |
482 |
requestWindowFeature( Window.FEATURE_NO_TITLE );
|
22 |
torben |
481 |
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 |
torben |
500 |
/*
|
43 |
torben |
484 |
String appName = WelcomeScreen.this.getResources().getString(R.string.app_name);
|
44 |
|
|
String ver = WelcomeScreen.this.getResources().getString(R.string.app_version);
|
45 |
|
|
|
46 |
torben |
483 |
StringBuffer message = new StringBuffer();
|
47 |
torben |
484 |
message.append(appName);
|
48 |
|
|
message.append(" v").append(ver).append("\n");
|
49 |
torben |
483 |
message.append("By Torben H. Nielsen\n");
|
50 |
|
|
|
51 |
torben |
500 |
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 |
torben |
481 |
}
|
55 |
torben |
483 |
|
56 |
torben |
481 |
}
|
57 |
torben |
483 |
|
58 |
torben |
481 |
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 |
|
|
}
|