Permalink
Browse files

Fix force close on orientation change while refreshing the schedule

  • Loading branch information...
1 parent 3b0edb0 commit bd068ba09659c9d5b1f6fd03582b0ae488a7f57f @tuxmobil committed Aug 1, 2011
Showing with 31 additions and 25 deletions.
  1. +1 −1 AndroidManifest.xml
  2. +1 −1 libs/ActionBar
  3. +29 −23 src/nerd/tuxmobil/fahrplan/camp11/Fahrplan.java
View
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="nerd.tuxmobil.fahrplan.camp11" android:versionName="1.03" android:versionCode="4">
+ package="nerd.tuxmobil.fahrplan.camp11" android:versionCode="5" android:versionName="1.04">
<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="7"/>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
@@ -129,12 +129,15 @@ public int getDrawable() {
public String getText() {
return getString(R.string.day);
}
+
+ @Override
+ public void ready(View view) {
+ }
});
actionBar.addAction(new Action() {
@Override
public void performAction(View view) {
- refreshBtn = view;
fetchFahrplan();
}
@Override
@@ -145,6 +148,11 @@ public int getDrawable() {
public String getText() {
return null;
}
+
+ @Override
+ public void ready(View view) {
+ refreshBtn = view;
+ }
});
// final TextView leftText = (TextView) findViewById(R.id.title_left_text);
@@ -870,14 +878,7 @@ public void onParseDone(Boolean result, String version) {
Log.d(LOG_TAG, "parseDone: " + result);
MyApp.task_running = TASKS.NONE;
MyApp.fahrplan_xml = null;
- boolean refreshDisplay = false;
- if (result) {
- if ((MyApp.numdays == 0) || (!version.equals(MyApp.version))) {
- refreshDisplay = true;
- }
- } else {
- // FIXME Fehlermeldung;
- }
+
setProgressBarIndeterminateVisibility(false);
if (MyApp.numdays == 0) {
progress.dismiss();
@@ -887,21 +888,26 @@ public void onParseDone(Boolean result, String version) {
statusBar.setVisibility(View.GONE);
refreshBtn.setVisibility(View.VISIBLE);
}
-
- if (refreshDisplay) {
- loadMeta();
- loadDays();
- SharedPreferences prefs = getSharedPreferences(PREFS_NAME, 0);
- day = prefs.getInt("displayDay", 1);
- if (day > MyApp.numdays) {
- day = 1;
+ if (result) {
+ if ((MyApp.numdays == 0) || (!version.equals(MyApp.version))) {
+ loadMeta();
+ loadDays();
+ SharedPreferences prefs = getSharedPreferences(PREFS_NAME, 0);
+ day = prefs.getInt("displayDay", 1);
+ if (day > MyApp.numdays) {
+ day = 1;
+ }
+ viewDay(true);
+ final Toast done = Toast.makeText(global
+ .getApplicationContext(), String.format(
+ getString(R.string.aktualisiert_auf), version),
+ Toast.LENGTH_LONG);
+ done.show();
+ } else {
+ viewDay(false);
}
- viewDay(true);
- final Toast done = Toast.makeText(global
- .getApplicationContext(), String.format(
- getString(R.string.aktualisiert_auf), version),
- Toast.LENGTH_LONG);
- done.show();
+ } else {
+ // FIXME Fehlermeldung;
}
}

0 comments on commit bd068ba

Please sign in to comment.