aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps/cache
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-01-24 21:39:58 +0100
committerBananeweizen <bananeweizen@gmx.de>2012-01-24 21:39:58 +0100
commit9b0459d3928befa7e08333769a70a5f8710baaf2 (patch)
tree1abbb4749f3912a5ab722e311143a5e80be0ea7d /main/src/cgeo/geocaching/apps/cache
parentbeb7f7be8f127fba5ad333d6c31cefd1596157b6 (diff)
downloadcgeo-9b0459d3928befa7e08333769a70a5f8710baaf2.zip
cgeo-9b0459d3928befa7e08333769a70a5f8710baaf2.tar.gz
cgeo-9b0459d3928befa7e08333769a70a5f8710baaf2.tar.bz2
refactoring: minor simplification of code
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cache')
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java18
1 files changed, 6 insertions, 12 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
index ac1cd8a..75001f3 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
@@ -65,11 +65,11 @@ public final class NavigationAppFactory extends AbstractAppFactory {
}
public static void showNavigationMenu(final cgGeo geo, final Activity activity, final cgCache cache, final SearchResult search) {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.cache_menu_navigate);
builder.setIcon(android.R.drawable.ic_menu_mapmode);
final List<NavigationAppsEnum> installed = getInstalledNavigationApps(activity);
- String[] items = new String[installed.size()];
+ final String[] items = new String[installed.size()];
for (int i = 0; i < installed.size(); i++) {
items[i] = installed.get(i).app.getName();
}
@@ -78,7 +78,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
installed.get(item).app.invoke(geo, activity, cache, search, null, null);
}
});
- AlertDialog alert = builder.create();
+ final AlertDialog alert = builder.create();
alert.show();
}
@@ -124,7 +124,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
public static void startDefaultNavigationApplication(final cgGeo geo, Activity activity, cgCache cache,
final SearchResult search, cgWaypoint waypoint, final Geopoint destination) {
- NavigationApp app = getDefaultNavigationApplication(activity);
+ final NavigationApp app = getDefaultNavigationApplication(activity);
if (app != null) {
try {
@@ -144,21 +144,15 @@ public final class NavigationAppFactory extends AbstractAppFactory {
public static NavigationApp getDefaultNavigationApplication(Activity activity) {
final int defaultNavigationTool = Settings.getDefaultNavigationTool();
- NavigationApp app = null;
final List<NavigationAppsEnum> installedNavigationApps = getInstalledNavigationApps(activity);
for (NavigationAppsEnum navigationApp : installedNavigationApps) {
if (navigationApp.id == defaultNavigationTool) {
- app = navigationApp.app;
- break;
+ return navigationApp.app;
}
}
// default navigation tool wasn't set already or couldn't be found (not installed any more for example)
- if (app == null) {
- // assume that 0 is the compass-app
- app = installedNavigationApps.get(0).app;
- }
- return app;
+ return NavigationAppsEnum.COMPASS.app;
}
}