aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps/cachelist
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-10-24 23:13:37 +0200
committerSamuel Tardieu <sam@rfc1149.net>2011-10-24 23:15:28 +0200
commitb6d19eeea75e255c40756b59e1c977988082589f (patch)
treedc63be180c54217850319ebe233ab938a10c8582 /main/src/cgeo/geocaching/apps/cachelist
parente5efa831a88cab7675b65a3fb596990d88975ee2 (diff)
downloadcgeo-b6d19eeea75e255c40756b59e1c977988082589f.zip
cgeo-b6d19eeea75e255c40756b59e1c977988082589f.tar.gz
cgeo-b6d19eeea75e255c40756b59e1c977988082589f.tar.bz2
Do not use an extra indirection for storing search results
What is called search result (or cgSearch) in c:geo is a collection of caches that can or cannot come from a real search. Remove the indirection and the ever-growing hash map that was previously used. This will save memory, especially when using live maps. See discussion in issue #707.
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cachelist')
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java4
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java8
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java6
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java4
4 files changed, 11 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java
index c4d51d2..2788d2b 100644
--- a/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java
+++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java
@@ -2,18 +2,18 @@ package cgeo.geocaching.apps.cachelist;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgGeo;
+import cgeo.geocaching.cgSearch;
import cgeo.geocaching.apps.App;
import android.app.Activity;
import android.content.res.Resources;
import java.util.List;
-import java.util.UUID;
interface CacheListApp extends App {
boolean invoke(final cgGeo geo, final List<cgCache> caches,
final Activity activity, final Resources res,
- final UUID searchId);
+ final cgSearch search);
}
diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java
index 5b3dc9a..46ceb8b 100644
--- a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java
@@ -1,9 +1,10 @@
package cgeo.geocaching.apps.cachelist;
import cgeo.geocaching.R;
+import cgeo.geocaching.Settings;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgGeo;
-import cgeo.geocaching.Settings;
+import cgeo.geocaching.cgSearch;
import cgeo.geocaching.apps.AbstractAppFactory;
import org.apache.commons.lang3.ArrayUtils;
@@ -17,7 +18,6 @@ import android.view.SubMenu;
import java.util.ArrayList;
import java.util.List;
-import java.util.UUID;
public final class CacheListAppFactory extends AbstractAppFactory {
private static CacheListApp[] apps = new CacheListApp[] {};
@@ -64,11 +64,11 @@ public final class CacheListAppFactory extends AbstractAppFactory {
public static boolean onMenuItemSelected(final MenuItem item,
final cgGeo geo, final List<cgCache> caches, final Activity activity, final Resources res,
- final UUID searchId) {
+ final cgSearch search) {
CacheListApp app = (CacheListApp) getAppFromMenuItem(item, apps);
if (app != null) {
try {
- return app.invoke(geo, caches, activity, res, searchId);
+ return app.invoke(geo, caches, activity, res, search);
} catch (Exception e) {
Log.e(Settings.tag, "CacheListAppFactory.onMenuItemSelected: " + e.toString());
}
diff --git a/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java b/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java
index 6de5c13..3038872 100644
--- a/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java
+++ b/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java
@@ -3,6 +3,7 @@ package cgeo.geocaching.apps.cachelist;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgGeo;
+import cgeo.geocaching.cgSearch;
import cgeo.geocaching.apps.AbstractApp;
import cgeo.geocaching.maps.CGeoMap;
@@ -11,7 +12,6 @@ import android.content.Context;
import android.content.res.Resources;
import java.util.List;
-import java.util.UUID;
class InternalCacheListMap extends AbstractApp implements CacheListApp {
@@ -25,8 +25,8 @@ class InternalCacheListMap extends AbstractApp implements CacheListApp {
}
@Override
- public boolean invoke(cgGeo geo, List<cgCache> caches, Activity activity, Resources res, final UUID searchId) {
- CGeoMap.startActivitySearch(activity, searchId, null, false);
+ public boolean invoke(cgGeo geo, List<cgCache> caches, Activity activity, Resources res, final cgSearch search) {
+ CGeoMap.startActivitySearch(activity, search, null, false);
return true;
}
}
diff --git a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java
index 4cce8d7..eddd6ac 100644
--- a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java
+++ b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java
@@ -2,6 +2,7 @@ package cgeo.geocaching.apps.cachelist;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgGeo;
+import cgeo.geocaching.cgSearch;
import cgeo.geocaching.apps.AbstractLocusApp;
import org.apache.commons.collections.CollectionUtils;
@@ -10,7 +11,6 @@ import android.app.Activity;
import android.content.res.Resources;
import java.util.List;
-import java.util.UUID;
class LocusCacheListApp extends AbstractLocusApp implements CacheListApp {
@@ -26,7 +26,7 @@ class LocusCacheListApp extends AbstractLocusApp implements CacheListApp {
*/
@Override
public boolean invoke(cgGeo geo, List<cgCache> cacheList, Activity activity, Resources res,
- final UUID searchId) {
+ final cgSearch search) {
if (CollectionUtils.isEmpty(cacheList)) {
return false;
}