aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/StaticMapsActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/StaticMapsActivity.java')
-rw-r--r--main/src/cgeo/geocaching/StaticMapsActivity.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java
index ceceab9..be363f0 100644
--- a/main/src/cgeo/geocaching/StaticMapsActivity.java
+++ b/main/src/cgeo/geocaching/StaticMapsActivity.java
@@ -27,14 +27,11 @@ import java.util.List;
@OptionsMenu(R.menu.static_maps_activity_options)
public class StaticMapsActivity extends AbstractActionBarActivity {
- private static final String EXTRAS_WAYPOINT = "waypoint";
- private static final String EXTRAS_DOWNLOAD = "download";
- private static final String EXTRAS_GEOCODE = "geocode";
-
- @Extra(EXTRAS_DOWNLOAD) boolean download = false;
- @Extra(EXTRAS_WAYPOINT) Integer waypointId = null;
- @Extra(EXTRAS_GEOCODE) String geocode = null;
+ @Extra(Intents.EXTRA_DOWNLOAD) boolean download = false;
+ @Extra(Intents.EXTRA_WAYPOINT_ID) Integer waypointId = null;
+ @Extra(Intents.EXTRA_GEOCODE) String geocode = null;
+ private Geocache cache;
private final List<Bitmap> maps = new ArrayList<>();
private LayoutInflater inflater = null;
private ProgressDialog waitDialog = null;
@@ -94,12 +91,16 @@ public class StaticMapsActivity extends AbstractActionBarActivity {
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState, R.layout.staticmaps_activity);
- if (geocode == null) {
- showToast("Sorry, c:geo forgot for what cache you want to load static maps.");
+ cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+
+ if (cache == null) {
+ Log.e("StaticMapsActivity.onCreate: cannot find the cache " + geocode);
finish();
return;
}
+ setCacheTitleBar(cache);
+
waitDialog = ProgressDialog.show(this, null, res.getString(R.string.map_static_loading), true);
waitDialog.setCancelable(true);
@@ -116,7 +117,6 @@ public class StaticMapsActivity extends AbstractActionBarActivity {
for (int level = 1; level <= StaticMapsProvider.MAPS_LEVEL_MAX; level++) {
try {
if (waypointId != null) {
- final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
final Bitmap image = StaticMapsProvider.getWaypointMap(geocode, cache.getWaypointById(waypointId), level);
if (image != null) {
maps.add(image);
@@ -150,7 +150,6 @@ public class StaticMapsActivity extends AbstractActionBarActivity {
}
private boolean downloadStaticMaps() {
- final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
if (waypointId == null) {
showToast(res.getString(R.string.info_storing_static_maps));
RxUtils.waitForCompletion(StaticMapsProvider.storeCacheStaticMap(cache));