5 |
import android.net.Uri; |
import android.net.Uri; |
6 |
import android.os.Bundle; |
import android.os.Bundle; |
7 |
import android.os.Handler; |
import android.os.Handler; |
8 |
import android.os.Message; |
import android.util.Log; |
9 |
import android.view.View; |
import android.view.View; |
10 |
import android.view.Window; |
import android.view.Window; |
11 |
import android.view.View.OnClickListener; |
import android.view.View.OnClickListener; |
13 |
|
|
14 |
import com.nullwire.trace.ExceptionHandler; |
import com.nullwire.trace.ExceptionHandler; |
15 |
|
|
16 |
import dk.thoerup.checkupdates.CheckUpdates; |
import dk.thoerup.androidutils.CheckUpdates; |
17 |
|
import dk.thoerup.traininfo.provider.ProviderFactory; |
18 |
|
|
19 |
public class WelcomeScreen extends Activity{ |
public class WelcomeScreen extends Activity{ |
20 |
public enum ListType { |
public enum ListType { |
27 |
|
|
28 |
@Override |
@Override |
29 |
public void onCreate(Bundle savedInstanceState) { |
public void onCreate(Bundle savedInstanceState) { |
30 |
requestWindowFeature( Window.FEATURE_NO_TITLE ); |
|
31 |
super.onCreate(savedInstanceState); |
super.onCreate(savedInstanceState); |
32 |
|
requestWindowFeature( Window.FEATURE_NO_TITLE ); |
33 |
setContentView(R.layout.welcome); |
setContentView(R.layout.welcome); |
34 |
|
|
35 |
Button nearestButton = (Button) findViewById(R.id.nearest); |
Button nearestButton = (Button) findViewById(R.id.nearest); |
41 |
Button favoritesButton = (Button) findViewById(R.id.favorites); |
Button favoritesButton = (Button) findViewById(R.id.favorites); |
42 |
favoritesButton.setOnClickListener( new StationListListener(ListType.ListFavorites)); |
favoritesButton.setOnClickListener( new StationListListener(ListType.ListFavorites)); |
43 |
|
|
44 |
|
Button settingsButton = (Button) findViewById(R.id.settings); |
45 |
|
settingsButton.setOnClickListener( new SettingsListener() ); |
46 |
|
|
47 |
Button aboutButton = (Button) findViewById(R.id.about); |
Button aboutButton = (Button) findViewById(R.id.about); |
48 |
aboutButton.setOnClickListener( new AboutListener() ); |
aboutButton.setOnClickListener( new AboutListener() ); |
49 |
|
|
50 |
ExceptionHandler.register(this, "http://t-hoerup.dk/android/trace.php"); |
ExceptionHandler.register(this, "http://t-hoerup.dk/android/trace.php"); |
51 |
|
|
52 |
CheckUpdates update = new CheckUpdates(); |
CheckUpdates update = new CheckUpdates(); |
53 |
update.checkForUpdates(this, "http://t-hoerup.dk/android/traininfo/version.txt", "TrainInfo DK"); |
update.checkForUpdates(this, "http://t-hoerup.dk/android/traininfo/version.txt", "TrainInfo DK", null); |
54 |
|
/* |
55 |
Runnable r = new Runnable() { |
Runnable r = new Runnable() { |
56 |
@Override |
@Override |
57 |
public void run() { |
public void run() { |
60 |
} |
} |
61 |
}; |
}; |
62 |
handler.postDelayed(r, 1500); |
handler.postDelayed(r, 1500); |
63 |
|
*/ |
64 |
} |
} |
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@Override |
69 |
|
protected void onDestroy() { |
70 |
|
super.onDestroy(); |
71 |
|
ProviderFactory.purgeOldEntries(); //exiting application, do some cleanup |
72 |
|
} |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
class AboutListener implements OnClickListener { |
class AboutListener implements OnClickListener { |
78 |
|
|
79 |
@Override |
@Override |
88 |
message.append("By Torben H. Nielsen\n"); |
message.append("By Torben H. Nielsen\n"); |
89 |
|
|
90 |
MessageBox.showMessage(WelcomeScreen.this, message.toString());*/ |
MessageBox.showMessage(WelcomeScreen.this, message.toString());*/ |
91 |
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.t-hoerup.dk/android/traininfo/")); |
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://t-hoerup.dk/android/traininfo/")); |
92 |
startActivity(browserIntent); |
startActivity(browserIntent); |
93 |
} |
} |
94 |
|
|
95 |
} |
} |
96 |
|
|
97 |
|
class SettingsListener implements OnClickListener{ |
98 |
|
|
99 |
|
@Override |
100 |
|
public void onClick(View v) { |
101 |
|
Intent intent = new Intent(WelcomeScreen.this, SettingsScreen.class); |
102 |
|
WelcomeScreen.this.startActivity(intent); |
103 |
|
} |
104 |
|
} |
105 |
|
|
106 |
class StationListListener implements OnClickListener{ |
class StationListListener implements OnClickListener{ |
107 |
ListType launchType; |
ListType launchType; |