diff options
Diffstat (limited to 'main/src/cgeo/geocaching/loaders')
6 files changed, 53 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java b/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java index ebf29d1..1cc9706 100644 --- a/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java +++ b/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java @@ -17,6 +17,7 @@ public abstract class AbstractSearchLoader extends AsyncTaskLoader<SearchResult> public enum CacheListLoaderType { OFFLINE, + POCKET, HISTORY, NEAREST, COORDINATE, diff --git a/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java index 722f9f5..605f461 100644 --- a/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java @@ -1,8 +1,8 @@ package cgeo.geocaching.loaders; +import cgeo.geocaching.DataStore; import cgeo.geocaching.SearchResult; import cgeo.geocaching.settings.Settings; -import cgeo.geocaching.cgData; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.geopoint.Geopoint; @@ -18,7 +18,7 @@ public class HistoryGeocacheListLoader extends AbstractSearchLoader { @Override public SearchResult runSearch() { - return cgData.getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL); + return DataStore.getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL); } } diff --git a/main/src/cgeo/geocaching/loaders/KeywordGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/KeywordGeocacheListLoader.java index adfc423..c8132e7 100644 --- a/main/src/cgeo/geocaching/loaders/KeywordGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/KeywordGeocacheListLoader.java @@ -1,8 +1,10 @@ package cgeo.geocaching.loaders; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.settings.Settings; +import cgeo.geocaching.connector.ConnectorFactory; +import cgeo.geocaching.connector.capability.ISearchByKeyword; import cgeo.geocaching.connector.gc.GCParser; +import cgeo.geocaching.settings.Settings; import android.content.Context; @@ -17,7 +19,18 @@ public class KeywordGeocacheListLoader extends AbstractSearchLoader { @Override public SearchResult runSearch() { - return GCParser.searchByKeyword(keyword, Settings.getCacheType(), Settings.isShowCaptcha(), this); + SearchResult searchResult = new SearchResult(); + if (Settings.isGCConnectorActive()) { + searchResult = GCParser.searchByKeyword(keyword, Settings.getCacheType(), Settings.isShowCaptcha(), this); + } + + for (ISearchByKeyword connector : ConnectorFactory.getSearchByKeywordConnectors()) { + if (connector.isActivated()) { + searchResult.addSearchResult(connector.searchByName(keyword)); + } + } + + return searchResult; } } diff --git a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java index ab8ba6a..5088484 100644 --- a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java @@ -2,7 +2,7 @@ package cgeo.geocaching.loaders; import cgeo.geocaching.SearchResult; import cgeo.geocaching.settings.Settings; -import cgeo.geocaching.cgData; +import cgeo.geocaching.DataStore; import cgeo.geocaching.geopoint.Geopoint; import android.content.Context; @@ -20,7 +20,7 @@ public class OfflineGeocacheListLoader extends AbstractSearchLoader { @Override public SearchResult runSearch() { - return cgData.getBatchOfStoredCaches(searchCenter, Settings.getCacheType(), listId); + return DataStore.getBatchOfStoredCaches(searchCenter, Settings.getCacheType(), listId); } public void setListId(int listId) { diff --git a/main/src/cgeo/geocaching/loaders/PocketGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/PocketGeocacheListLoader.java new file mode 100644 index 0000000..32fb020 --- /dev/null +++ b/main/src/cgeo/geocaching/loaders/PocketGeocacheListLoader.java @@ -0,0 +1,28 @@ +package cgeo.geocaching.loaders; + +import cgeo.geocaching.SearchResult; +import cgeo.geocaching.connector.gc.GCParser; +import cgeo.geocaching.settings.Settings; + +import android.content.Context; + +public class PocketGeocacheListLoader extends AbstractSearchLoader { + private final String guid; + + public PocketGeocacheListLoader(Context context, String guid) { + super(context); + this.guid = guid; + } + + @Override + public SearchResult runSearch() { + + if (Settings.isGCConnectorActive()) { + return GCParser.searchByPocketQuery(guid, Settings.getCacheType(), Settings.isShowCaptcha(), this); + } + + return new SearchResult(); + + } + +} diff --git a/main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java b/main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java index 2229afe..dc1a5df 100644 --- a/main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java +++ b/main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java @@ -1,10 +1,10 @@ package cgeo.geocaching.loaders; +import cgeo.geocaching.DataStore; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.settings.Settings; -import cgeo.geocaching.cgData; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.settings.Settings; import android.content.Context; @@ -15,14 +15,14 @@ public class RemoveFromHistoryLoader extends AbstractSearchLoader { public RemoveFromHistoryLoader(Context context, String[] selected, Geopoint coords) { super(context); - this.selected = selected; + this.selected = selected.clone(); this.coords = coords; } @Override public SearchResult runSearch() { - cgData.clearVisitDate(selected); - return cgData.getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL); + DataStore.clearVisitDate(selected); + return DataStore.getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL); } } |
