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.StationEntry; |
12 |
import dk.thoerup.traininfo.WelcomeScreen.ListType; |
import dk.thoerup.traininfo.WelcomeScreen.ListType; |
13 |
|
|
14 |
public class ShortcutActivity extends Activity { |
public class ShortcutActivity extends Activity { |
17 |
final static int SHOW_STATIONS = 2000; |
final static int SHOW_STATIONS = 2000; |
18 |
|
|
19 |
|
|
20 |
StationBean station; |
StationEntry station; |
21 |
Button okBtn; |
Button okBtn; |
22 |
|
|
23 |
@Override |
@Override |
64 |
} else { |
} else { |
65 |
//launched by the user clicking on the shortcut |
//launched by the user clicking on the shortcut |
66 |
String stationStr = intent.getStringExtra("station"); |
String stationStr = intent.getStringExtra("station"); |
67 |
StationBean station = StationBean.fromCSV(stationStr); |
StationEntry station = StationEntry.fromCSV(stationStr); |
68 |
|
|
69 |
Intent launcher = new Intent( this, DepartureList.class ); |
Intent launcher = new Intent( this, DepartureList.class ); |
70 |
launcher.putExtra("stationbean", station); |
launcher.putExtra("stationbean", station); |
99 |
* 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 |
100 |
* triggers the desired action within your Activity. |
* triggers the desired action within your Activity. |
101 |
*/ |
*/ |
102 |
private void setupShortcut(StationBean station) { |
private void setupShortcut(StationEntry station) { |
103 |
// First, set up the shortcut intent. |
// First, set up the shortcut intent. |
104 |
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); |
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); |
105 |
shortcutIntent.setClassName(this, this.getClass().getName()); |
shortcutIntent.setClassName(this, this.getClass().getName()); |
129 |
|
|
130 |
case SHOW_STATIONS: |
case SHOW_STATIONS: |
131 |
if (data != null) { |
if (data != null) { |
132 |
station = (StationBean) data.getSerializableExtra("station"); |
station = (StationEntry) data.getSerializableExtra("station"); |
133 |
if (station != null) { |
if (station != null) { |
134 |
okBtn.setEnabled(true); |
okBtn.setEnabled(true); |
135 |
|
|