aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2012-12-19 20:44:05 +0100
committerSamuel Tardieu <sam@rfc1149.net>2012-12-19 20:44:05 +0100
commitc0c92e54755d6603785c4de37c70ae78efe880b1 (patch)
treeaea10049c187003b0e1fe10586c932d1864aaf68
parent8e375c548899bd719814a306ab4fc5fcacbf40f5 (diff)
parent837579bb1da27f7549dba8e4bb83b466131e3778 (diff)
downloadcgeo-c0c92e54755d6603785c4de37c70ae78efe880b1.zip
cgeo-c0c92e54755d6603785c4de37c70ae78efe880b1.tar.gz
cgeo-c0c92e54755d6603785c4de37c70ae78efe880b1.tar.bz2
Merge branch 'fix_2276_dialog_forever' of https://github.com/triakcz/c-geo-opensource into upstream
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index c82e521..6c33dde 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -2547,11 +2547,27 @@ public class CacheDetailActivity extends AbstractActivity {
dismiss();
final ProgressDialog p = ProgressDialog.show(CacheDetailActivity.this, res.getString(R.string.cache), res.getString(R.string.waypoint_reset), true);
Handler h = new Handler() {
+ private boolean remoteFinished=false;
+ private boolean localFinished=false;
+
@Override
public void handleMessage(Message msg) {
- p.dismiss();
- notifyDataSetChanged();
+ switch (msg.what) {
+ case ResetCoordsThread.LOCAL:
+ localFinished=true;
+ break;
+ case ResetCoordsThread.ON_WEBSITE:
+ remoteFinished=true;
+ break;
+
+ }
+
+ if ((localFinished || !resetLocalyOption.isChecked()) && (remoteFinished || !uploadOption.isChecked())) {
+ p.dismiss();
+ notifyDataSetChanged();
+ }
}
+
};
new ResetCoordsThread(cache, h, wpt, resetLocalyOption.isChecked(), uploadOption.isChecked(), p).start();
}
@@ -2573,6 +2589,8 @@ public class CacheDetailActivity extends AbstractActivity {
private final boolean remote;
private final cgWaypoint wpt;
private ProgressDialog progress;
+ public static final int LOCAL = 0;
+ public static final int ON_WEBSITE = 1;
public ResetCoordsThread(cgCache cache, Handler handler, final cgWaypoint wpt, boolean local, boolean remote, final ProgressDialog progress) {
this.cache = cache;
@@ -2597,6 +2615,7 @@ public class CacheDetailActivity extends AbstractActivity {
cache.setUserModifiedCoords(false);
cache.deleteWaypointForce(wpt);
cgData.saveChangedCache(cache);
+ handler.sendEmptyMessage(LOCAL);
}
IConnector con = ConnectorFactory.getConnector(cache);
@@ -2619,7 +2638,7 @@ public class CacheDetailActivity extends AbstractActivity {
} else {
showToast(getString(R.string.waypoint_coordinates_upload_error));
}
- handler.sendMessage(Message.obtain());
+ handler.sendEmptyMessage(ON_WEBSITE);
notifyDataSetChanged();
}