13 |
import android.net.Uri; |
import android.net.Uri; |
14 |
import android.os.AsyncTask; |
import android.os.AsyncTask; |
15 |
import android.os.Bundle; |
import android.os.Bundle; |
16 |
|
import android.util.Log; |
17 |
import android.view.View; |
import android.view.View; |
18 |
import android.widget.ListView; |
import android.widget.ListView; |
19 |
import android.widget.TextView; |
import android.widget.TextView; |
20 |
import dk.thoerup.traininfo.provider.DepartureProvider; |
import dk.thoerup.traininfo.provider.DepartureProvider; |
21 |
import dk.thoerup.traininfo.provider.ProviderFactory; |
import dk.thoerup.traininfo.provider.ProviderFactory; |
22 |
import dk.thoerup.traininfo.util.MessageBox; |
import dk.thoerup.traininfo.util.MessageBox; |
23 |
|
import static dk.thoerup.traininfo.R.string.*; |
24 |
|
|
25 |
public class DepartureList extends ListActivity { |
public class DepartureList extends ListActivity { |
26 |
|
|
130 |
switch (id) { |
switch (id) { |
131 |
case DLG_PROGRESS: |
case DLG_PROGRESS: |
132 |
ProgressDialog dlg = new ProgressDialog(this); |
ProgressDialog dlg = new ProgressDialog(this); |
133 |
dlg.setMessage("Fetch departure data"); |
dlg.setMessage( getString(departurelist_fetchdata) ); |
134 |
dlg.setCancelable(true); |
dlg.setCancelable(true); |
135 |
return dlg; |
return dlg; |
136 |
default: |
default: |
188 |
AlertDialog.Builder builder = new AlertDialog.Builder(DepartureList.this); |
AlertDialog.Builder builder = new AlertDialog.Builder(DepartureList.this); |
189 |
builder.setMessage("Error finding departures"); |
builder.setMessage("Error finding departures"); |
190 |
builder.setCancelable(true); |
builder.setCancelable(true); |
191 |
builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() { |
builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() { |
192 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
193 |
dialog.dismiss(); |
dialog.dismiss(); |
194 |
startDepartureFetcher(); |
startDepartureFetcher(); |
195 |
|
|
196 |
} |
} |
197 |
}); |
}); |
198 |
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
199 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
200 |
dialog.dismiss(); |
dialog.dismiss(); |
201 |
} |
} |
202 |
}); |
}); |
203 |
builder.show(); |
|
204 |
|
try { |
205 |
|
builder.show(); |
206 |
|
} catch (android.view.WindowManager.BadTokenException e) { |
207 |
|
Log.i("DepartureList", "BadTokenException"); // this can happen if the user switched away from this activity, while doInBackground was running |
208 |
|
} |
209 |
} |
} |
210 |
} |
} |
211 |
|
|