--- android/TrainInfo/src/dk/thoerup/traininfo/DepartureList.java 2011/05/04 09:03:08 1445 +++ android/TrainInfo/src/dk/thoerup/traininfo/DepartureList.java 2011/05/04 20:25:15 1446 @@ -14,10 +14,12 @@ import android.content.ActivityNotFoundException; import android.content.DialogInterface; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Typeface; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; +import android.preference.PreferenceManager; import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -77,8 +79,8 @@ setContentView(R.layout.departurelist); adapter = new DepartureListAdapter(this); - setListAdapter(adapter); - + setListAdapter(adapter); + Intent launchedBy = getIntent(); station = (StationEntry) launchedBy.getSerializableExtra("stationbean"); @@ -195,6 +197,8 @@ Log.e("Station", station.toCSV() ); + + if (station.isMetro() == false) { metroBtn.setVisibility( View.GONE ); } @@ -223,6 +227,16 @@ trainType = "STOG"; } + //Both enabled - use preferred from preferences + if (station.isRegional() == true && station.isStrain() == true ) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + trainType = prefs.getString("traintype", "REGIONAL"); //default value is gps + + if (trainType.equals("STOG") ) { + stogBtn.setBackgroundResource(R.drawable.custom_button_hilight); + regionalBtn.setBackgroundResource(R.drawable.custom_button); + } + } if (station.isRegional() == false && station.isStrain() == false) { @@ -263,6 +277,8 @@ } } + + boolean hasNotifications() { return (departures != null && departures.notifications.size() > 0); }