aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/DataStore.java2
-rw-r--r--main/src/cgeo/geocaching/LogCacheActivity.java5
-rw-r--r--main/src/cgeo/geocaching/TrackableActivity.java7
3 files changed, 11 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java
index 1081828..bd6e3e5 100644
--- a/main/src/cgeo/geocaching/DataStore.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -28,6 +28,7 @@ import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import rx.Observable;
import rx.Observable.OnSubscribe;
@@ -2010,6 +2011,7 @@ public class DataStore {
return trackables;
}
+ @Nullable
public static Trackable loadTrackable(final String geocode) {
if (StringUtils.isBlank(geocode)) {
return null;
diff --git a/main/src/cgeo/geocaching/LogCacheActivity.java b/main/src/cgeo/geocaching/LogCacheActivity.java
index 46b185a..d708210 100644
--- a/main/src/cgeo/geocaching/LogCacheActivity.java
+++ b/main/src/cgeo/geocaching/LogCacheActivity.java
@@ -431,7 +431,10 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
}
}
if (GCVote.isValidRating(rating) && GCVote.isVotingPossible(cache)) {
- if (!GCVote.setRating(cache, rating)) {
+ if (GCVote.setRating(cache, rating)) {
+ cache.setMyVote(rating);
+ DataStore.saveChangedCache(cache);
+ } else {
showToast(res.getString(R.string.err_gcvote_send_rating));
}
}
diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java
index a9f508c..45111f6 100644
--- a/main/src/cgeo/geocaching/TrackableActivity.java
+++ b/main/src/cgeo/geocaching/TrackableActivity.java
@@ -612,8 +612,11 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
// refresh the logs view after coming back from logging a trackable
if (trackable != null) {
final Trackable updatedTrackable = DataStore.loadTrackable(trackable.getGeocode());
- trackable.setLogs(updatedTrackable.getLogs());
- reinitializeViewPager();
+ // if this activity is resumed after a long time, the trackable might be gone due to regular cleanup
+ if (updatedTrackable != null) {
+ trackable.setLogs(updatedTrackable.getLogs());
+ reinitializeViewPager();
+ }
}
}