8 |
import android.view.View.OnClickListener; |
import android.view.View.OnClickListener; |
9 |
import android.widget.Button; |
import android.widget.Button; |
10 |
import android.widget.TextView; |
import android.widget.TextView; |
11 |
|
import dk.thoerup.android.traininfo.common.StationBean; |
12 |
|
import dk.thoerup.android.traininfo.common.StationBean.StationEntry; |
13 |
import dk.thoerup.traininfo.WelcomeScreen.ListType; |
import dk.thoerup.traininfo.WelcomeScreen.ListType; |
14 |
|
|
15 |
public class ShortcutActivity extends Activity { |
public class ShortcutActivity extends Activity { |
18 |
final static int SHOW_STATIONS = 2000; |
final static int SHOW_STATIONS = 2000; |
19 |
|
|
20 |
|
|
21 |
StationBean station; |
StationEntry station; |
22 |
Button okBtn; |
Button okBtn; |
23 |
|
|
24 |
@Override |
@Override |
65 |
} else { |
} else { |
66 |
//launched by the user clicking on the shortcut |
//launched by the user clicking on the shortcut |
67 |
String stationStr = intent.getStringExtra("station"); |
String stationStr = intent.getStringExtra("station"); |
68 |
StationBean station = StationBean.fromCSV(stationStr); |
StationEntry station = StationEntry.fromCSV(stationStr); |
69 |
|
|
70 |
Intent launcher = new Intent( this, DepartureList.class ); |
Intent launcher = new Intent( this, DepartureList.class ); |
71 |
launcher.putExtra("stationbean", station); |
launcher.putExtra("stationbean", station); |
100 |
* with an appropriate Uri for your content, but any Intent will work here as long as it |
* with an appropriate Uri for your content, but any Intent will work here as long as it |
101 |
* triggers the desired action within your Activity. |
* triggers the desired action within your Activity. |
102 |
*/ |
*/ |
103 |
private void setupShortcut(StationBean station) { |
private void setupShortcut(StationEntry station) { |
104 |
// First, set up the shortcut intent. |
// First, set up the shortcut intent. |
105 |
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); |
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); |
106 |
shortcutIntent.setClassName(this, this.getClass().getName()); |
shortcutIntent.setClassName(this, this.getClass().getName()); |
130 |
|
|
131 |
case SHOW_STATIONS: |
case SHOW_STATIONS: |
132 |
if (data != null) { |
if (data != null) { |
133 |
station = (StationBean) data.getSerializableExtra("station"); |
station = (StationEntry) data.getSerializableExtra("station"); |
134 |
if (station != null) { |
if (station != null) { |
135 |
okBtn.setEnabled(true); |
okBtn.setEnabled(true); |
136 |
|
|