/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java
ViewVC logotype

Annotation of /android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 743 - (hide annotations) (download)
Thu May 20 14:03:12 2010 UTC (14 years ago) by torben
File size: 2875 byte(s)
Add SplashScreen
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 torben 743 import android.os.Handler;
8     import android.os.Message;
9 torben 481 import android.view.View;
10 torben 482 import android.view.Window;
11 torben 481 import android.view.View.OnClickListener;
12     import android.widget.Button;
13    
14 torben 720 import com.nullwire.trace.ExceptionHandler;
15    
16     import dk.thoerup.checkupdates.CheckUpdates;
17    
18 torben 481 public class WelcomeScreen extends Activity{
19     public enum ListType {
20     ListNearest,
21     ListSearch,
22     ListFavorites
23     }
24    
25 torben 743 Handler handler = new Handler();
26    
27 torben 481 @Override
28     public void onCreate(Bundle savedInstanceState) {
29 torben 482 requestWindowFeature( Window.FEATURE_NO_TITLE );
30 torben 481 super.onCreate(savedInstanceState);
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 torben 568
45     ExceptionHandler.register(this, "http://t-hoerup.dk/android/trace.php");
46 torben 720
47     CheckUpdates update = new CheckUpdates();
48     update.checkForUpdates(this, "http://t-hoerup.dk/android/traininfo/version.txt", "TrainInfo DK");
49 torben 743
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 torben 481 }
59 torben 743
60 torben 481 class AboutListener implements OnClickListener {
61    
62     @Override
63     public void onClick(View v) {
64 torben 500 /*
65 torben 484 String appName = WelcomeScreen.this.getResources().getString(R.string.app_name);
66     String ver = WelcomeScreen.this.getResources().getString(R.string.app_version);
67    
68 torben 483 StringBuffer message = new StringBuffer();
69 torben 484 message.append(appName);
70     message.append(" v").append(ver).append("\n");
71 torben 483 message.append("By Torben H. Nielsen\n");
72    
73 torben 500 MessageBox.showMessage(WelcomeScreen.this, message.toString());*/
74     Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.t-hoerup.dk/android/traininfo/"));
75     startActivity(browserIntent);
76 torben 481 }
77 torben 483
78 torben 481 }
79 torben 483
80 torben 481 class StationListListener implements OnClickListener{
81     ListType launchType;
82     StationListListener(ListType type) {
83     launchType = type;
84     }
85    
86     @Override
87     public void onClick(View v) {
88     Intent intent = new Intent(WelcomeScreen.this, StationList.class);
89     intent.putExtra("type", launchType);
90     WelcomeScreen.this.startActivity(intent);
91     }
92    
93     }
94     }

  ViewVC Help
Powered by ViewVC 1.1.20