4 |
import java.util.List; |
import java.util.List; |
5 |
|
|
6 |
|
|
7 |
|
import android.app.Activity; |
8 |
import android.app.AlertDialog; |
import android.app.AlertDialog; |
9 |
import android.app.Dialog; |
import android.app.Dialog; |
10 |
import android.app.ListActivity; |
import android.app.ListActivity; |
37 |
import dk.thoerup.traininfo.util.IntSet; |
import dk.thoerup.traininfo.util.IntSet; |
38 |
import dk.thoerup.traininfo.util.MessageBox; |
import dk.thoerup.traininfo.util.MessageBox; |
39 |
|
|
40 |
|
import static dk.thoerup.traininfo.R.string.*; |
41 |
|
|
42 |
public class StationList extends ListActivity { |
public class StationList extends ListActivity { |
43 |
public static final int GOTLOCATION = 1001; |
public static final int GOTLOCATION = 1001; |
44 |
public static final int GOTSTATIONLIST = 1002; |
public static final int GOTSTATIONLIST = 1002; |
47 |
|
|
48 |
public static final int OPTIONS_MAP = 2003; |
public static final int OPTIONS_MAP = 2003; |
49 |
public static final int OPTIONS_GPSINFO = 2004; |
public static final int OPTIONS_GPSINFO = 2004; |
|
|
|
|
|
|
|
|
|
50 |
|
|
51 |
public static final int DLG_PROGRESS = 3001; |
public static final int DLG_PROGRESS = 3001; |
52 |
public static final int DLG_STATIONNAME = 3002; |
public static final int DLG_STATIONNAME = 3002; |
53 |
|
|
54 |
|
|
55 |
|
public static final int GPS_TIMEOUT_MS = 15000; //how long are we willing to wait for gps fix -in milliseconds |
56 |
|
|
57 |
|
|
58 |
static enum LookupMethod { |
static enum LookupMethod { |
59 |
ByLocation, |
ByLocation, |
60 |
ByName, |
ByName, |
70 |
StationsFetchedHandler stationsFetched = new StationsFetchedHandler(); |
StationsFetchedHandler stationsFetched = new StationsFetchedHandler(); |
71 |
|
|
72 |
GeoPair location = new GeoPair(); |
GeoPair location = new GeoPair(); |
73 |
|
|
74 |
|
boolean isLaunchedforShortcut; |
75 |
boolean isRunning = false; |
boolean isRunning = false; |
76 |
List<StationBean> stations = new ArrayList<StationBean>(); |
List<StationBean> stations = new ArrayList<StationBean>(); |
77 |
|
|
113 |
listType = (WelcomeScreen.ListType) getIntent().getSerializableExtra("type"); |
listType = (WelcomeScreen.ListType) getIntent().getSerializableExtra("type"); |
114 |
setTitle(); |
setTitle(); |
115 |
|
|
116 |
|
isLaunchedforShortcut = getIntent().getBooleanExtra("shortcut", false); |
117 |
|
|
118 |
|
ProviderFactory.purgeOldEntries(); //cleanup before fetching more data |
119 |
|
|
120 |
if (savedInstanceState == null) { |
if (savedInstanceState == null) { |
121 |
|
|
122 |
|
|
124 |
case ListNearest: |
case ListNearest: |
125 |
startLookup(); |
startLookup(); |
126 |
break; |
break; |
127 |
case ListSearch: |
case ListSearch: |
128 |
this.showDialog(DLG_STATIONNAME); |
showDialog(DLG_STATIONNAME); |
129 |
break; |
break; |
130 |
case ListFavorites: |
case ListFavorites: |
131 |
startFavoriteLookup(); |
startFavoriteLookup(); |
141 |
} |
} |
142 |
|
|
143 |
} |
} |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
@Override |
151 |
|
protected void onDestroy() { |
152 |
|
super.onDestroy(); |
153 |
|
|
154 |
|
isRunning = false; |
155 |
|
|
156 |
|
if (locationLookup != null) { |
157 |
|
locationLookup.stopSearch(); |
158 |
|
} |
159 |
|
if (findStationsTask != null) { |
160 |
|
findStationsTask.cancel(true); |
161 |
|
} |
162 |
|
} |
163 |
|
|
164 |
|
|
165 |
protected void setTitle() { |
protected void setTitle() { |
166 |
String dialogTitle = getResources().getString(R.string.app_name); |
String dialogTitle = getResources().getString(app_name); |
167 |
switch (listType) { |
switch (listType) { |
168 |
case ListNearest: |
case ListNearest: |
169 |
dialogTitle += " - Nearby stations"; |
dialogTitle += " - " + getString(stationlist_nearbystations); |
170 |
break; |
break; |
171 |
case ListSearch: |
case ListSearch: |
172 |
dialogTitle += " - Search"; |
dialogTitle += " - " + getString(stationlist_search); |
173 |
break; |
break; |
174 |
case ListFavorites: |
case ListFavorites: |
175 |
dialogTitle += " - Favorites"; |
dialogTitle += " - " + getString(stationlist_favorites); |
176 |
break; |
break; |
177 |
default: |
default: |
178 |
dialogTitle = "";//not possible |
dialogTitle = "";//not possible |
179 |
} |
} |
180 |
|
|
181 |
setTitle(dialogTitle); |
setTitle(dialogTitle); |
182 |
|
|
183 |
} |
} |
184 |
|
|
185 |
|
|
|
|
|
186 |
|
|
187 |
@Override |
@Override |
188 |
public void onSaveInstanceState(Bundle outState) |
public void onSaveInstanceState(Bundle outState) |
199 |
@Override |
@Override |
200 |
public boolean onCreateOptionsMenu(Menu menu) { |
public boolean onCreateOptionsMenu(Menu menu) { |
201 |
MenuItem item; |
MenuItem item; |
202 |
|
|
203 |
item = menu.add(0, OPTIONS_MAP, 0, "Station map"); |
item = menu.add(0, OPTIONS_MAP, 0, getString(stationlist_stationmap)); |
204 |
item.setIcon(android.R.drawable.ic_menu_mapmode); |
item.setIcon(android.R.drawable.ic_menu_mapmode); |
205 |
|
|
206 |
item = menu.add(0, OPTIONS_GPSINFO, 0, "GPS Info"); |
item = menu.add(0, OPTIONS_GPSINFO, 0, getString(stationlist_gpsinfo)); |
207 |
item.setIcon(android.R.drawable.ic_menu_mapmode); |
item.setIcon(android.R.drawable.ic_menu_mapmode); |
208 |
|
|
209 |
return true; |
return true; |
231 |
case OPTIONS_GPSINFO: |
case OPTIONS_GPSINFO: |
232 |
Location loc = locationLookup.getLocation(); |
Location loc = locationLookup.getLocation(); |
233 |
StringBuffer message = new StringBuffer(); |
StringBuffer message = new StringBuffer(); |
234 |
message.append("Location info:\n"); |
message.append( getString(stationlist_locationinfo) ).append(":\n"); |
235 |
if (loc != null) { |
if (loc != null) { |
236 |
message.append("-Obtained by: ").append( loc.getProvider() ).append("\n"); |
message.append( getString(stationlist_obtainedby) ).append( loc.getProvider() ).append("\n"); |
237 |
message.append("-Accuracy: ").append( (int)loc.getAccuracy()).append("m\n"); |
message.append( getString(stationlist_accuracy) ).append( (int)loc.getAccuracy()).append("m\n"); |
238 |
message.append("-Latitude: ").append( loc.getLatitude()).append("\n"); |
message.append( getString(stationlist_latitude) ).append( (float)loc.getLatitude()).append("\n"); |
239 |
message.append("-Longitude: ").append( loc.getLongitude() ).append("\n"); |
message.append( getString(stationlist_longitude) ).append( (float)loc.getLongitude() ).append("\n"); |
240 |
} else { |
} else { |
241 |
message.append(" - No location data!"); |
message.append( getString(stationlist_nolocation) ); |
242 |
} |
} |
243 |
|
|
244 |
MessageBox.showMessage(this, message.toString()); |
MessageBox.showMessage(this, message.toString(), false); |
245 |
break; |
break; |
246 |
default: |
default: |
247 |
retval = super.onOptionsItemSelected(item); |
retval = super.onOptionsItemSelected(item); |
281 |
switch (id) { |
switch (id) { |
282 |
case DLG_PROGRESS: |
case DLG_PROGRESS: |
283 |
ProgressDialog dlg = new ProgressDialog(this); |
ProgressDialog dlg = new ProgressDialog(this); |
284 |
dlg.setMessage("Wait for location fix"); |
dlg.setMessage( getString(stationlist_waitforlocation) ); |
285 |
dlg.setCancelable(false); |
dlg.setCancelable(false); |
286 |
return dlg; |
return dlg; |
287 |
case DLG_STATIONNAME: |
case DLG_STATIONNAME: |
291 |
|
|
292 |
AlertDialog.Builder builder = new AlertDialog.Builder(this); |
AlertDialog.Builder builder = new AlertDialog.Builder(this); |
293 |
|
|
294 |
builder.setTitle("Station search"); |
builder.setTitle( getString(stationlist_stationsearch) ); |
295 |
builder.setView(rootView); |
builder.setView(rootView); |
296 |
builder.setCancelable(true); |
builder.setCancelable(true); |
297 |
builder.setPositiveButton("Search", new DialogInterface.OnClickListener() { |
builder.setPositiveButton( getString(generic_search), new DialogInterface.OnClickListener() { |
298 |
public void onClick(DialogInterface dialog, int which) { |
public void onClick(DialogInterface dialog, int which) { |
299 |
EditText et = (EditText) rootView.findViewById(R.id.EditText); |
EditText et = (EditText) rootView.findViewById(R.id.EditText); |
300 |
dialog.dismiss(); |
dialog.dismiss(); |
301 |
if (et.getText().toString().length() >= 2) { |
String search = et.getText().toString().trim(); |
302 |
startNameSearch(et.getText().toString()); |
if (search.length() >= 2) { |
303 |
|
startNameSearch(search); |
304 |
} else { |
} else { |
305 |
showMessageAndClose("Two characters minimum"); |
showMessageAndClose( getString(stationlist_twocharmin) ); |
306 |
} |
} |
307 |
} |
} |
308 |
}); |
}); |
309 |
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
310 |
public void onClick(DialogInterface dialog, int which) { |
public void onClick(DialogInterface dialog, int which) { |
311 |
dialog.dismiss(); |
dialog.dismiss(); |
312 |
StationList.this.finish(); // Close this Activity |
StationList.this.finish(); // Close this Activity |
341 |
|
|
342 |
StationBean station = stations.get(position); |
StationBean station = stations.get(position); |
343 |
|
|
344 |
Intent intent = new Intent(this, DepartureList.class); |
if (isLaunchedforShortcut == true) { |
345 |
intent.putExtra("stationbean", station); |
Intent i = new Intent(); |
346 |
startActivity(intent); |
i.putExtra("station", station); |
347 |
|
setResult(Activity.RESULT_OK, i); |
348 |
|
finish(); |
349 |
|
} else { |
350 |
|
Intent intent = new Intent(this, DepartureList.class); |
351 |
|
intent.putExtra("stationbean", station); |
352 |
|
startActivity(intent); |
353 |
|
} |
354 |
} |
} |
355 |
|
|
356 |
///////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////// |
357 |
// |
// |
358 |
|
|
359 |
public void startLookup() { |
public void startLookup() { |
360 |
isRunning = true; |
isRunning = true; |
361 |
dialogMessage = "Wait for location fix"; |
dialogMessage = getString( stationlist_waitforlocation ); |
362 |
showDialog(DLG_PROGRESS); |
showDialog(DLG_PROGRESS); |
363 |
|
|
364 |
locationLookup.locateStations(); |
locationLookup.locateStations(); |
365 |
stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, 20000); |
stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, GPS_TIMEOUT_MS); |
366 |
} |
} |
367 |
|
|
368 |
void startNameSearch(String name) { |
void startNameSearch(String name) { |
369 |
dialogMessage = "Finding stations by name"; |
dialogMessage = getString( stationlist_findbyname ); |
370 |
showDialog(DLG_PROGRESS); |
showDialog(DLG_PROGRESS); |
371 |
|
|
372 |
findStationsTask = new FindStationsTask(); |
findStationsTask = new FindStationsTask(); |
373 |
findStationsTask.searchByName(name, locationLookup.getLocation()); |
findStationsTask.searchByName(name); |
374 |
findStationsTask.execute(); |
findStationsTask.execute(); |
375 |
|
|
376 |
} |
} |
378 |
public void startFavoriteLookup() { |
public void startFavoriteLookup() { |
379 |
|
|
380 |
if (favorites.size() > 0) { |
if (favorites.size() > 0) { |
381 |
dialogMessage = "Loading favorites"; |
dialogMessage = getString( stationlist_loadfavorites ); |
382 |
showDialog(DLG_PROGRESS); |
showDialog(DLG_PROGRESS); |
383 |
|
|
384 |
findStationsTask = new FindStationsTask(); |
findStationsTask = new FindStationsTask(); |
385 |
findStationsTask.searchByIds(favorites.toString(), locationLookup.getLocation()); |
findStationsTask.searchByIds( favorites.toString() ); |
386 |
findStationsTask.execute(); |
findStationsTask.execute(); |
387 |
} else { |
} else { |
388 |
showMessageAndClose( "Favorite list is empty"); |
showMessageAndClose( getString( stationlist_nofavorites ) ); |
389 |
} |
} |
390 |
} |
} |
391 |
|
|
393 |
|
|
394 |
void startLocatorTask() |
void startLocatorTask() |
395 |
{ |
{ |
396 |
dialogMessage = "Finding nearby stations"; |
dialogMessage = getString( stationlist_findingnearby ); |
397 |
showDialog(DLG_PROGRESS); |
showDialog(DLG_PROGRESS); |
398 |
|
|
399 |
findStationsTask = new FindStationsTask(); |
findStationsTask = new FindStationsTask(); |
400 |
findStationsTask.searchByLocation( locationLookup.getLocation() ); |
findStationsTask.searchByLocation( locationLookup.getLocation() ); |
401 |
findStationsTask.execute(); |
findStationsTask.execute(); |
402 |
} |
} |
|
|
|
|
|
|
|
/* TODO: Remove this no longer needed function |
|
|
String lookupAddress(double latitude, double longitude) { |
|
403 |
|
|
|
Geocoder coder = new Geocoder(this, new Locale("da")); |
|
|
StringBuilder sb = new StringBuilder(); |
|
|
Log.i("lookupaddr", "" + latitude + "/" + longitude); |
|
|
try { |
|
|
List<Address> addressList = coder.getFromLocation(latitude, longitude, 1); |
|
|
Address addr = addressList.get(0); |
|
|
|
|
|
|
|
|
int max = addr.getMaxAddressLineIndex(); |
|
|
for (int i=0; i<max; i++) { |
|
|
if (i>0) |
|
|
sb.append(", "); |
|
|
|
|
|
sb.append(addr.getAddressLine(i)); |
|
|
} |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
Log.e("DepartureList", "geocoder failed", e); |
|
|
} |
|
|
|
|
|
return sb.toString(); |
|
|
}*/ |
|
|
|
|
404 |
|
|
405 |
//////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////// |
406 |
// Inner classes |
// Inner classes |
420 |
|
|
421 |
case NOPROVIDER: |
case NOPROVIDER: |
422 |
dismissDialog(DLG_PROGRESS); |
dismissDialog(DLG_PROGRESS); |
423 |
MessageBox.showMessage(StationList.this,"No location provider enabled. Plase enable gps."); |
MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider), true ); |
424 |
|
//StationList.this.finish(); |
425 |
break; |
break; |
426 |
case LOCATIONFIXTIMEOUT: |
case LOCATIONFIXTIMEOUT: |
427 |
if (isRunning) { |
if (isRunning) { |
432 |
dismissDialog(DLG_PROGRESS); |
dismissDialog(DLG_PROGRESS); |
433 |
|
|
434 |
AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this); |
AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this); |
435 |
builder.setMessage("Location fix timed out"); |
builder.setMessage( getString( stationlist_gpstimeout) ); |
436 |
builder.setCancelable(true); |
builder.setCancelable(true); |
437 |
builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() { |
builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() { |
438 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
439 |
dialog.dismiss(); |
dialog.dismiss(); |
440 |
startLookup(); |
startLookup(); |
441 |
|
|
442 |
} |
} |
443 |
}); |
}); |
444 |
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { |
builder.setNegativeButton( getString(generic_cancel), new DialogInterface.OnClickListener() { |
445 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
446 |
dialog.dismiss(); |
dialog.dismiss(); |
447 |
} |
} |
448 |
}); |
}); |
449 |
builder.show(); |
builder.show(); |
450 |
|
|
451 |
} |
} |
452 |
} |
} |
460 |
class FindStationsTask extends AsyncTask<Void,Void,Void> { |
class FindStationsTask extends AsyncTask<Void,Void,Void> { |
461 |
|
|
462 |
LookupMethod method = LookupMethod.MethodNone; |
LookupMethod method = LookupMethod.MethodNone; |
|
boolean success; |
|
463 |
String name; |
String name; |
464 |
Location loc; |
Location loc; |
465 |
String ids; |
String ids; |
466 |
|
|
467 |
public void searchByName(String n, Location l) { |
public void searchByName(String n) { |
468 |
|
|
469 |
method = LookupMethod.ByName; |
method = LookupMethod.ByName; |
|
loc = l; |
|
470 |
name = n; |
name = n; |
471 |
} |
} |
472 |
|
|
475 |
loc = l; |
loc = l; |
476 |
} |
} |
477 |
|
|
478 |
public void searchByIds(String id, Location l) { |
public void searchByIds(String id) { |
479 |
|
|
480 |
method = LookupMethod.ByList; |
method = LookupMethod.ByList; |
|
loc = l; |
|
481 |
ids = id; |
ids = id; |
482 |
} |
} |
483 |
|
|
494 |
|
|
495 |
switch (method) { |
switch (method) { |
496 |
case ByLocation: |
case ByLocation: |
497 |
success = stationProvider.lookupStations(loc); |
stations = stationProvider.lookupStations(loc); |
498 |
break; |
break; |
499 |
case ByName: |
case ByName: |
500 |
success = stationProvider.lookupStationsByName(name); |
stations = stationProvider.lookupStationsByName(name); |
501 |
break; |
break; |
502 |
case ByList: |
case ByList: |
503 |
success = stationProvider.lookupStationsByIds(ids); |
stations = stationProvider.lookupStationsByIds(ids); |
504 |
break; |
break; |
505 |
default: |
default: |
506 |
success = false; // not possible |
stations = null; // not possible |
507 |
} |
} |
508 |
|
|
509 |
|
|
|
Location dummy = new Location("gps"); |
|
|
List<StationBean> stations = stationProvider.getStations(); |
|
|
|
|
|
for (StationBean station : stations) { |
|
|
|
|
|
if (method.equals(LookupMethod.ByName) || method.equals(LookupMethod.ByList)) { |
|
|
if (loc != null) { //only do the distance calc if we have a location |
|
|
dummy.setLatitude(station.getLatitude()); |
|
|
dummy.setLongitude(station.getLongitude()); |
|
|
station.setDistance( (int)loc.distanceTo(dummy) ); |
|
|
} else { |
|
|
station.setDistance(0); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
510 |
return null; |
return null; |
511 |
} |
} |
512 |
|
|
516 |
dialog.dismiss(); |
dialog.dismiss(); |
517 |
|
|
518 |
|
|
519 |
if (success) { |
if (stations != null) { |
520 |
if (stationProvider.getStations().size() == 0) |
if (stations.size() == 0) { |
521 |
MessageBox.showMessage(StationList.this, "No stations found!"); // this should not be possible !?! |
showMessageAndClose(getString(stationlist_nostations)); |
522 |
stations = stationProvider.getStations(); |
} |
523 |
|
|
524 |
|
StationList.this.getListView().invalidateViews(); |
525 |
adapter.setStations( stations ); |
adapter.setStations( stations ); |
526 |
|
|
527 |
|
|
528 |
} else { //communication or parse errors |
} else { //communication or parse errors |
529 |
AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this); |
AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this); |
530 |
builder.setMessage("Error on finding nearby stations"); |
builder.setMessage(getString(stationlist_fetcherror)); |
531 |
builder.setCancelable(true); |
builder.setCancelable(true); |
532 |
builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() { |
builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() { |
533 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
534 |
dialog.dismiss(); |
dialog.dismiss(); |
535 |
|
|
536 |
stationsFetched.post( new Runnable() { |
Runnable runner = null; |
537 |
@Override |
switch (method) { |
538 |
public void run() { |
case ByLocation: |
539 |
startLocatorTask(); |
runner = new Runnable() { |
540 |
} |
@Override |
541 |
}); |
public void run() { |
542 |
|
startLocatorTask(); |
543 |
|
} |
544 |
|
}; |
545 |
|
break; |
546 |
|
case ByName: |
547 |
|
runner = new Runnable() { |
548 |
|
@Override |
549 |
|
public void run() { |
550 |
|
startNameSearch( FindStationsTask.this.name ); |
551 |
|
} |
552 |
|
}; |
553 |
|
break; |
554 |
|
case ByList: |
555 |
|
runner = new Runnable() { |
556 |
|
@Override |
557 |
|
public void run() { |
558 |
|
startFavoriteLookup(); |
559 |
|
} |
560 |
|
}; |
561 |
|
break; |
562 |
|
} |
563 |
|
|
564 |
|
stationsFetched.post( runner ); |
565 |
} |
} |
566 |
}); |
}); |
567 |
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
568 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
569 |
dialog.dismiss(); |
dialog.dismiss(); |
570 |
|
StationList.this.finish(); |
571 |
} |
} |
572 |
}); |
}); |
573 |
builder.show(); |
|
574 |
|
builder.show(); |
575 |
} |
} |
576 |
} |
} |
577 |
} |
} |
592 |
int stationID = stations.get(selectedPosition).getId(); |
int stationID = stations.get(selectedPosition).getId(); |
593 |
|
|
594 |
if (!favorites.contains(stationID)) { |
if (!favorites.contains(stationID)) { |
595 |
menu.add(0, FAVORITES_ADD, 0, "Add to favorites"); |
menu.add(0, FAVORITES_ADD, 0, getString(stationlist_addfavorite) ); |
596 |
} else { |
} else { |
597 |
menu.add(0, FAVORITES_REMOVE, 0, "Remove from favorites"); |
menu.add(0, FAVORITES_REMOVE, 0, getString(stationlist_removefavorite) ); |
598 |
} |
} |
599 |
|
|
600 |
} |
} |
605 |
int stationID = sb.getId(); |
int stationID = sb.getId(); |
606 |
if (item.getItemId() == FAVORITES_ADD) { |
if (item.getItemId() == FAVORITES_ADD) { |
607 |
favorites.add(stationID); |
favorites.add(stationID); |
608 |
Toast.makeText(StationList.this, "Station added", Toast.LENGTH_SHORT).show(); |
Toast.makeText(StationList.this, getString(stationlist_stationadded), Toast.LENGTH_SHORT).show(); |
609 |
} else { |
} else { |
610 |
|
|
611 |
favorites.remove(stationID); |
favorites.remove(stationID); |
612 |
Toast.makeText(StationList.this, "Station removed", Toast.LENGTH_SHORT).show(); |
Toast.makeText(StationList.this, getString(stationlist_stationremoved), Toast.LENGTH_SHORT).show(); |
613 |
|
|
614 |
|
|
615 |
if (listType.equals( WelcomeScreen.ListType.ListFavorites) ) { |
if (listType.equals( WelcomeScreen.ListType.ListFavorites) ) { |