/[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 1131 - (show annotations) (download)
Fri Sep 24 11:07:44 2010 UTC (13 years, 7 months ago) by torben
File size: 2865 byte(s)
CheckUpdates is now in androidutils
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.os.Handler;
8 import android.view.View;
9 import android.view.Window;
10 import android.view.View.OnClickListener;
11 import android.widget.Button;
12
13 import com.nullwire.trace.ExceptionHandler;
14
15 import dk.thoerup.androidutils.CheckUpdates;
16
17 public class WelcomeScreen extends Activity{
18 public enum ListType {
19 ListNearest,
20 ListSearch,
21 ListFavorites
22 }
23
24 Handler handler = new Handler();
25
26 @Override
27 public void onCreate(Bundle savedInstanceState) {
28
29 super.onCreate(savedInstanceState);
30 requestWindowFeature( Window.FEATURE_NO_TITLE );
31 setContentView(R.layout.welcome);
32
33 Button nearestButton = (Button) findViewById(R.id.nearest);
34 nearestButton.setOnClickListener( new StationListListener(ListType.ListNearest));
35
36 Button searchButton = (Button) findViewById(R.id.search);
37 searchButton.setOnClickListener( new StationListListener(ListType.ListSearch));
38
39 Button favoritesButton = (Button) findViewById(R.id.favorites);
40 favoritesButton.setOnClickListener( new StationListListener(ListType.ListFavorites));
41
42 Button aboutButton = (Button) findViewById(R.id.about);
43 aboutButton.setOnClickListener( new AboutListener() );
44
45 ExceptionHandler.register(this, "http://t-hoerup.dk/android/trace.php");
46
47 CheckUpdates update = new CheckUpdates();
48 update.checkForUpdates(this, "http://t-hoerup.dk/android/traininfo/version.txt", "TrainInfo DK", null);
49 /*
50 Runnable r = new Runnable() {
51 @Override
52 public void run() {
53 View splash = findViewById(R.id.splash);
54 splash.setVisibility(View.GONE);
55 }
56 };
57 handler.postDelayed(r, 1500);
58 */
59 }
60
61 class AboutListener implements OnClickListener {
62
63 @Override
64 public void onClick(View v) {
65 /*
66 String appName = WelcomeScreen.this.getResources().getString(R.string.app_name);
67 String ver = WelcomeScreen.this.getResources().getString(R.string.app_version);
68
69 StringBuffer message = new StringBuffer();
70 message.append(appName);
71 message.append(" v").append(ver).append("\n");
72 message.append("By Torben H. Nielsen\n");
73
74 MessageBox.showMessage(WelcomeScreen.this, message.toString());*/
75 Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.t-hoerup.dk/android/traininfo/"));
76 startActivity(browserIntent);
77 }
78
79 }
80
81 class StationListListener implements OnClickListener{
82 ListType launchType;
83 StationListListener(ListType type) {
84 launchType = type;
85 }
86
87 @Override
88 public void onClick(View v) {
89 Intent intent = new Intent(WelcomeScreen.this, StationList.class);
90 intent.putExtra("type", launchType);
91 WelcomeScreen.this.startActivity(intent);
92 }
93
94 }
95 }

  ViewVC Help
Powered by ViewVC 1.1.20