aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-05-17 08:51:24 +0200
committerBananeweizen <bananeweizen@gmx.de>2014-05-17 08:51:24 +0200
commit496878826d638367c129b02e66f992202e0d36c9 (patch)
tree12b5932c47a90baa20c7f66770a11affc8cad4ba /main/src/cgeo
parent2b2753afb1a0bf528315ea2b3efa9dc61a5e6bdf (diff)
downloadcgeo-496878826d638367c129b02e66f992202e0d36c9.zip
cgeo-496878826d638367c129b02e66f992202e0d36c9.tar.gz
cgeo-496878826d638367c129b02e66f992202e0d36c9.tar.bz2
fix #3255: don't ask for list when storing from history
Diffstat (limited to 'main/src/cgeo')
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java3
-rw-r--r--main/src/cgeo/geocaching/CacheListActivity.java22
-rw-r--r--main/src/cgeo/geocaching/CachePopup.java3
-rw-r--r--main/src/cgeo/geocaching/Geocache.java8
4 files changed, 19 insertions, 17 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 11fe672..7d231c9 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -56,6 +56,7 @@ import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
+
import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Observer;
@@ -1053,7 +1054,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
progress.show(CacheDetailActivity.this, res.getString(R.string.cache_dialog_refresh_title), res.getString(R.string.cache_dialog_refresh_message), true, refreshCacheHandler.cancelMessage());
- cache.refresh(cache.getListId(), refreshCacheHandler, Schedulers.io());
+ cache.refresh(refreshCacheHandler, Schedulers.io());
}
}
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java
index 87f03da..c45d77d 100644
--- a/main/src/cgeo/geocaching/CacheListActivity.java
+++ b/main/src/cgeo/geocaching/CacheListActivity.java
@@ -1019,21 +1019,25 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
return;
}
- if (Settings.getChooseList() && type != CacheListType.OFFLINE) {
+ if (Settings.getChooseList() && (type != CacheListType.OFFLINE && type != CacheListType.HISTORY)) {
// let user select list to store cache in
new StoredList.UserInterface(this).promptForListSelection(R.string.list_title,
new Action1<Integer>() {
@Override
public void call(final Integer selectedListId) {
- refreshStored(caches, selectedListId);
+ // in case of online lists, set the list id to a concrete list now
+ for (Geocache geocache : caches) {
+ geocache.setListId(selectedListId);
+ }
+ refreshStoredInternal(caches);
}
}, true, StoredList.TEMPORARY_LIST_ID, newListName);
} else {
- refreshStored(caches, this.listId);
+ refreshStoredInternal(caches);
}
}
- private void refreshStored(final List<Geocache> caches, final int storeListId) {
+ private void refreshStoredInternal(final List<Geocache> caches) {
detailProgress = 0;
showProgress(false);
@@ -1051,7 +1055,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
detailProgressTime = System.currentTimeMillis();
- final LoadDetailsThread threadDetails = new LoadDetailsThread(loadDetailsHandler, caches, storeListId);
+ final LoadDetailsThread threadDetails = new LoadDetailsThread(loadDetailsHandler, caches);
threadDetails.start();
}
@@ -1124,15 +1128,11 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
private class LoadDetailsThread extends Thread {
final private CancellableHandler handler;
- final private int listIdLD;
final private List<Geocache> caches;
- public LoadDetailsThread(CancellableHandler handler, List<Geocache> caches, int listId) {
+ public LoadDetailsThread(CancellableHandler handler, List<Geocache> caches) {
this.handler = handler;
this.caches = caches;
-
- // in case of online lists, set the list id to the standard list
- this.listIdLD = Math.max(listId, StoredList.STANDARD_LIST_ID);
}
@Override
@@ -1167,7 +1167,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
throw new InterruptedException("Stopped storing process.");
}
detailProgress++;
- cache.refreshSynchronous(listIdLD, null);
+ cache.refreshSynchronous(null);
handler.sendEmptyMessage(cacheList.indexOf(cache));
} catch (final InterruptedException e) {
Log.i(e.getMessage());
diff --git a/main/src/cgeo/geocaching/CachePopup.java b/main/src/cgeo/geocaching/CachePopup.java
index f91d275..b72b67c 100644
--- a/main/src/cgeo/geocaching/CachePopup.java
+++ b/main/src/cgeo/geocaching/CachePopup.java
@@ -11,6 +11,7 @@ import cgeo.geocaching.utils.CancellableHandler;
import cgeo.geocaching.utils.Log;
import org.apache.commons.lang3.StringUtils;
+
import rx.functions.Action0;
import rx.functions.Action1;
import rx.schedulers.Schedulers;
@@ -151,7 +152,7 @@ public class CachePopup extends AbstractPopupActivity {
final StoreCacheHandler refreshCacheHandler = new StoreCacheHandler(R.string.cache_dialog_offline_save_message);
progress.show(CachePopup.this, res.getString(R.string.cache_dialog_refresh_title), res.getString(R.string.cache_dialog_refresh_message), true, refreshCacheHandler.cancelMessage());
- cache.refresh(cache.getListId(), refreshCacheHandler, Schedulers.io());
+ cache.refresh(refreshCacheHandler, Schedulers.io());
}
}
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index a88ceca..fdfdbb5 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -1496,19 +1496,19 @@ public class Geocache implements ICache, IWaypoint {
}
}
- public Subscription refresh(final int newListId, final CancellableHandler handler, final Scheduler scheduler) {
+ public Subscription refresh(final CancellableHandler handler, final Scheduler scheduler) {
return scheduler.createWorker().schedule(new Action0() {
@Override
public void call() {
- refreshSynchronous(newListId, handler);
+ refreshSynchronous(handler);
handler.sendEmptyMessage(CancellableHandler.DONE);
}
});
}
- public void refreshSynchronous(final int newListId, final CancellableHandler handler) {
+ public void refreshSynchronous(final CancellableHandler handler) {
DataStore.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
- storeCache(null, geocode, newListId, true, handler);
+ storeCache(null, geocode, listId, true, handler);
}
public static void storeCache(Geocache origCache, String geocode, int listId, boolean forceRedownload, CancellableHandler handler) {