aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching
diff options
context:
space:
mode:
authortriakcz <kunc88@gmail.com>2012-12-19 20:02:37 +0100
committertriakcz <kunc88@gmail.com>2012-12-19 20:02:37 +0100
commit837579bb1da27f7549dba8e4bb83b466131e3778 (patch)
tree7802011787ea8a6e637da18d07da84d4173c3ec1 /main/src/cgeo/geocaching
parentb2951e465ca783c4eab32e642ed885625b417f12 (diff)
downloadcgeo-837579bb1da27f7549dba8e4bb83b466131e3778.zip
cgeo-837579bb1da27f7549dba8e4bb83b466131e3778.tar.gz
cgeo-837579bb1da27f7549dba8e4bb83b466131e3778.tar.bz2
Fix #2276, close dialog after both requested operations are completed
Diffstat (limited to 'main/src/cgeo/geocaching')
-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 b7ae292..85a1f9c 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -2548,11 +2548,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();
}
@@ -2574,6 +2590,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;
@@ -2598,6 +2616,7 @@ public class CacheDetailActivity extends AbstractActivity {
cache.setUserModifiedCoords(false);
cache.deleteWaypointForce(wpt);
cgData.saveChangedCache(cache);
+ handler.sendEmptyMessage(LOCAL);
}
IConnector con = ConnectorFactory.getConnector(cache);
@@ -2620,7 +2639,7 @@ public class CacheDetailActivity extends AbstractActivity {
} else {
showToast(getString(R.string.waypoint_coordinates_upload_error));
}
- handler.sendMessage(Message.obtain());
+ handler.sendEmptyMessage(ON_WEBSITE);
notifyDataSetChanged();
}