aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/res/values/strings.xml2
-rw-r--r--main/src/cgeo/geocaching/VisitCacheActivity.java8
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java6
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java26
-rw-r--r--main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java22
-rw-r--r--main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java12
6 files changed, 54 insertions, 22 deletions
diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml
index 8761ea4..13926c5 100644
--- a/main/res/values/strings.xml
+++ b/main/res/values/strings.xml
@@ -374,7 +374,7 @@
<string name="init_login_popup_working">Logging in…</string>
<string name="init_login_popup_ok">Login OK</string>
<string name="init_login_popup_failed">Login failed</string>
- <string name="init_login_popup_failed_reason">Login failed because of </string>
+ <string name="init_login_popup_failed_reason">Login failed:</string>
<string name="init_twitter_authorize">Authorize c:geo</string>
<string name="init_twitter_publish">Publish status when a cache has been found</string>
<string name="init_signature">Signature</string>
diff --git a/main/src/cgeo/geocaching/VisitCacheActivity.java b/main/src/cgeo/geocaching/VisitCacheActivity.java
index 25d36df..6f8ea92 100644
--- a/main/src/cgeo/geocaching/VisitCacheActivity.java
+++ b/main/src/cgeo/geocaching/VisitCacheActivity.java
@@ -419,9 +419,15 @@ public class VisitCacheActivity extends AbstractLoggingActivity implements DateD
}
@Override
+ public void finish() {
+ saveLog(false);
+ super.finish();
+ }
+
+ @Override
public void onStop() {
- super.onStop();
saveLog(false);
+ super.onStop();
}
@Override
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index d260a2d..c25005f 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -1467,10 +1467,13 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
showFooterLoadingCaches();
cgData.moveToList(adapter.getCheckedCaches(), listId);
- currentLoader = (AbstractSearchLoader) getSupportLoaderManager().initLoader(CacheListType.OFFLINE.ordinal(), new Bundle(), this);
+ currentLoader = (OfflineGeocacheListLoader) getSupportLoaderManager().initLoader(CacheListType.OFFLINE.ordinal(), new Bundle(), this);
currentLoader.reset();
+ ((OfflineGeocacheListLoader) currentLoader).setListId(listId);
+ ((OfflineGeocacheListLoader) currentLoader).setSearchCenter(coords);
currentLoader.startLoading();
+
invalidateOptionsMenuCompatible();
}
@@ -1808,6 +1811,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
cacheList.addAll(cachesFromSearchResult);
search = searchIn;
adapter.reFilter();
+ adapter.notifyDataSetChanged();
updateTitle();
showFooterMoreCaches();
}
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index 74ee072..c4060fe 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -151,7 +151,7 @@ class GpxExport extends AbstractExport {
gpx.attribute("", "creator", "c:geo - http://www.cgeo.org/");
gpx.attribute(PREFIX_XSI, "schemaLocation",
PREFIX_GPX + " http://www.topografix.com/GPX/1/0/gpx.xsd " +
- PREFIX_GROUNDSPEAK + " http://www.groundspeak.com/cache/1/0/1/cache.xsd");
+ PREFIX_GROUNDSPEAK + " http://www.groundspeak.com/cache/1/0/1/cache.xsd");
for (int i = 0; i < caches.size(); i++) {
final Geocache cache = cgData.loadCache(caches.get(i).getGeocode(), LoadFlags.LOAD_ALL_DB_ONLY);
@@ -178,7 +178,6 @@ class GpxExport extends AbstractExport {
gpx.attribute("", "available", !cache.isDisabled() ? "True" : "False");
gpx.attribute("", "archives", cache.isArchived() ? "True" : "False");
-
XmlUtils.multipleTexts(gpx, PREFIX_GROUNDSPEAK,
"name", cache.getName(),
"placed_by", cache.getOwnerDisplayName(),
@@ -274,17 +273,20 @@ class GpxExport extends AbstractExport {
* @throws IOException
*/
private void writeCacheWaypoint(final XmlSerializer gpx, final Waypoint wp, final String prefix) throws IOException {
- gpx.startTag(PREFIX_GPX, "wpt");
final Geopoint coords = wp.getCoords();
- gpx.attribute("", "lat", coords != null ? Double.toString(coords.getLatitude()) : ""); // TODO: check whether is the best way to handle unknown waypoint coordinates
- gpx.attribute("", "lon", coords != null ? Double.toString(coords.getLongitude()) : "");
- XmlUtils.multipleTexts(gpx, PREFIX_GPX,
- "name", prefix + wp.getGeocode().substring(2),
- "cmt", wp.getNote(),
- "desc", wp.getName(),
- "sym", wp.getWaypointType().toString(), //TODO: Correct identifier string
- "type", "Waypoint|" + wp.getWaypointType().toString()); //TODO: Correct identifier string
- gpx.endTag(PREFIX_GPX, "wpt");
+ // TODO: create some extension to GPX to include waypoint without coords
+ if (coords != null) {
+ gpx.startTag(PREFIX_GPX, "wpt");
+ gpx.attribute("", "lat", Double.toString(coords.getLatitude()));
+ gpx.attribute("", "lon", Double.toString(coords.getLongitude()));
+ XmlUtils.multipleTexts(gpx, PREFIX_GPX,
+ "name", prefix + wp.getGeocode().substring(2),
+ "cmt", wp.getNote(),
+ "desc", wp.getName(),
+ "sym", wp.getWaypointType().toString(), //TODO: Correct identifier string
+ "type", "Waypoint|" + wp.getWaypointType().toString()); //TODO: Correct identifier string
+ gpx.endTag(PREFIX_GPX, "wpt");
+ }
}
private void writeLogs(final XmlSerializer gpx, final Geocache cache) throws IOException {
diff --git a/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java b/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java
index 4214db9..eb96fa6 100644
--- a/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java
+++ b/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java
@@ -43,13 +43,20 @@ public abstract class AbstractSearchLoader extends AsyncTaskLoader<SearchResult>
@Override
public SearchResult loadInBackground() {
loading = true;
- if (search == null) {
- search = runSearch();
- } else {
- // Unless we make a new Search the Loader framework won't deliver results. It does't do equals only identity
- search = GCParser.searchByNextPage(new SearchResult(search), Settings.isShowCaptcha(), this);
+ try {
+ if (search == null) {
+ search = runSearch();
+ } else {
+ // Unless we make a new Search the Loader framework won't deliver results. It does't do equals only identity
+ search = GCParser.searchByNextPage(new SearchResult(search), Settings.isShowCaptcha(), this);
+ }
+ } catch (Exception e) {
+ Log.e("Error in Loader ", e);
}
loading = false;
+ if (search == null) {
+ search = new SearchResult();
+ }
return search;
}
@@ -106,4 +113,9 @@ public abstract class AbstractSearchLoader extends AsyncTaskLoader<SearchResult>
}
+ @Override
+ public void reset() {
+ super.reset();
+ search = null;
+ }
}
diff --git a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
index ef1029b..0081aa1 100644
--- a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
+++ b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
@@ -9,8 +9,8 @@ import android.content.Context;
public class OfflineGeocacheListLoader extends AbstractSearchLoader {
- private final int listId;
- private final Geopoint searchCenter;
+ private int listId;
+ private Geopoint searchCenter;
public OfflineGeocacheListLoader(Context context, Geopoint searchCenter, int listId) {
super(context);
@@ -23,4 +23,12 @@ public class OfflineGeocacheListLoader extends AbstractSearchLoader {
return cgData.getBatchOfStoredCaches(searchCenter, Settings.getCacheType(), listId);
}
+ public void setListId(int listId) {
+ this.listId = listId;
+ }
+
+ public void setSearchCenter(Geopoint searchCenter) {
+ this.searchCenter = searchCenter;
+ }
+
}