aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps/cache
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2012-04-20 20:16:40 +0200
committerSamuel Tardieu <sam@rfc1149.net>2012-04-20 22:14:19 +0200
commitb9b297a38accdd54641b325ece04f488bbf90fb8 (patch)
tree5ab47eb0f713148a86a03d7c14ee2223acbfb396 /main/src/cgeo/geocaching/apps/cache
parentc91a817d13a8f68cc5b7399ba4cbe7cd16a4645b (diff)
downloadcgeo-b9b297a38accdd54641b325ece04f488bbf90fb8.zip
cgeo-b9b297a38accdd54641b325ece04f488bbf90fb8.tar.gz
cgeo-b9b297a38accdd54641b325ece04f488bbf90fb8.tar.bz2
Refactoring: cleanup control flow
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cache')
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java28
1 files changed, 12 insertions, 16 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
index a0eb5a1..db316bd 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.apps.cache.navi;
+import cgeo.geocaching.ILogable;
import cgeo.geocaching.R;
import cgeo.geocaching.StaticMapsActivity;
import cgeo.geocaching.cgCache;
@@ -25,25 +26,20 @@ class StaticMapApp extends AbstractNavigationApp {
@Override
public boolean invoke(cgGeo geo, Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
-
- String geocode = null;
- if (cache != null && cache.getListId() != 0) {
- geocode = cache.getGeocode().toUpperCase();
- }
- if (waypoint != null) {
- geocode = waypoint.getGeocode().toUpperCase();
- }
+ final ILogable logable = cache != null && cache.getListId() != 0 ? cache : waypoint;
+ final String geocode = logable.getGeocode().toUpperCase();
if (geocode == null) {
ActivityMixin.showToast(activity, getString(R.string.err_detail_no_map_static));
return true;
- } else {
- final Intent intent = new Intent(activity, StaticMapsActivity.class);
- intent.putExtra("geocode", geocode);
- if (waypoint != null) {
- intent.putExtra("waypoint", waypoint.getId());
- }
- activity.startActivity(intent);
- return true;
}
+
+ final Intent intent = new Intent(activity, StaticMapsActivity.class);
+ intent.putExtra("geocode", geocode);
+ if (waypoint != null) {
+ intent.putExtra("waypoint", waypoint.getId());
+ }
+ activity.startActivity(intent);
+
+ return true;
}
}