1 |
package dk.thoerup.traininfo; |
package dk.thoerup.traininfo; |
2 |
|
|
3 |
|
import static dk.thoerup.traininfo.R.string.departurelist_fetchdata; |
4 |
|
import static dk.thoerup.traininfo.R.string.generic_cancel; |
5 |
|
import static dk.thoerup.traininfo.R.string.generic_retry; |
6 |
|
|
7 |
import java.text.NumberFormat; |
import java.text.NumberFormat; |
8 |
import java.util.ArrayList; |
import java.util.ArrayList; |
9 |
import java.util.List; |
import java.util.List; |
17 |
import android.net.Uri; |
import android.net.Uri; |
18 |
import android.os.AsyncTask; |
import android.os.AsyncTask; |
19 |
import android.os.Bundle; |
import android.os.Bundle; |
20 |
|
import android.util.Log; |
21 |
import android.view.View; |
import android.view.View; |
22 |
import android.widget.ListView; |
import android.widget.ListView; |
23 |
import android.widget.TextView; |
import android.widget.TextView; |
71 |
|
|
72 |
int distance = station.getDistance(); |
int distance = station.getDistance(); |
73 |
((TextView) findViewById(R.id.stationDistance)).setText( format.format((double)distance/1000.0) + " km." ); |
((TextView) findViewById(R.id.stationDistance)).setText( format.format((double)distance/1000.0) + " km." ); |
74 |
|
station.setRegional(true); |
75 |
|
Log.e("ASD", "" + station.isRegional() + "/" + station.isSTrain() + "/" + station.isMetro()); |
76 |
|
|
77 |
if (station.isRegional() == false && station.isSTrain() == false) { |
if (station.isRegional() == false && station.isSTrain() == false) { |
78 |
getListView().setVisibility( View.GONE ); |
getListView().setVisibility( View.GONE ); |
134 |
switch (id) { |
switch (id) { |
135 |
case DLG_PROGRESS: |
case DLG_PROGRESS: |
136 |
ProgressDialog dlg = new ProgressDialog(this); |
ProgressDialog dlg = new ProgressDialog(this); |
137 |
dlg.setMessage("Fetch departure data"); |
dlg.setMessage( getString(departurelist_fetchdata) ); |
138 |
dlg.setCancelable(true); |
dlg.setCancelable(true); |
139 |
return dlg; |
return dlg; |
140 |
default: |
default: |
192 |
AlertDialog.Builder builder = new AlertDialog.Builder(DepartureList.this); |
AlertDialog.Builder builder = new AlertDialog.Builder(DepartureList.this); |
193 |
builder.setMessage("Error finding departures"); |
builder.setMessage("Error finding departures"); |
194 |
builder.setCancelable(true); |
builder.setCancelable(true); |
195 |
builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() { |
builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() { |
196 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
197 |
dialog.dismiss(); |
dialog.dismiss(); |
198 |
startDepartureFetcher(); |
startDepartureFetcher(); |
199 |
|
|
200 |
} |
} |
201 |
}); |
}); |
202 |
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
203 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
204 |
dialog.dismiss(); |
dialog.dismiss(); |
205 |
} |
} |