diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2012-04-22 00:21:15 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2012-04-22 00:44:13 +0200 |
commit | 1350c98d53af21688b09fa7dfad38123c7e5b997 (patch) | |
tree | 776da4ad3297a33031d2f79bcc2005f240e6c496 /main/src/cgeo | |
parent | 1fc2e3a3e6a6d328bb7cba9cc103c2bc5f531876 (diff) | |
download | cgeo-1350c98d53af21688b09fa7dfad38123c7e5b997.zip cgeo-1350c98d53af21688b09fa7dfad38123c7e5b997.tar.gz cgeo-1350c98d53af21688b09fa7dfad38123c7e5b997.tar.bz2 |
Refactoring: remove redundant local variables
Diffstat (limited to 'main/src/cgeo')
8 files changed, 13 insertions, 31 deletions
diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java index 205b216..3b36b23 100644 --- a/main/src/cgeo/geocaching/Settings.java +++ b/main/src/cgeo/geocaching/Settings.java @@ -385,9 +385,7 @@ public final class Settings { } public static int getLastList() { - final int listId = sharedPrefs.getInt(KEY_LAST_USED_LIST, StoredList.STANDARD_LIST_ID); - - return listId; + return sharedPrefs.getInt(KEY_LAST_USED_LIST, StoredList.STANDARD_LIST_ID); } public static void saveLastList(final int listId) { @@ -424,15 +422,12 @@ public final class Settings { } public static boolean setMapFile(final String mapFile) { - final boolean commitResult = editSharedSettings(new PrefRunnable() { - + return editSharedSettings(new PrefRunnable() { @Override public void edit(Editor edit) { edit.putString(KEY_MAPFILE, mapFile); } }); - - return commitResult; } public static boolean isValidMapFile(final String mapFileIn) { diff --git a/main/src/cgeo/geocaching/apps/AbstractApp.java b/main/src/cgeo/geocaching/apps/AbstractApp.java index 1161a05..f79afe0 100644 --- a/main/src/cgeo/geocaching/apps/AbstractApp.java +++ b/main/src/cgeo/geocaching/apps/AbstractApp.java @@ -33,8 +33,7 @@ public abstract class AbstractApp implements App { try { // This can throw an exception where the exception type is only defined on API Level > 3 // therefore surround with try-catch - final Intent intent = packageManager.getLaunchIntentForPackage(packageName); - return intent; + return packageManager.getLaunchIntentForPackage(packageName); } catch (Exception e) { return null; } diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 44af0e6..a5ca2af 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -1770,16 +1770,13 @@ public class cgeocaches extends AbstractListActivity { if (responseFromWeb != null && responseFromWeb.getStatusLine().getStatusCode() == 200) { final String response = Network.getResponseData(responseFromWeb); if (response.length() > 2) { - - String GCcode = response; - delay = 1; - handler.sendMessage(handler.obtainMessage(1, GCcode)); + handler.sendMessage(handler.obtainMessage(1, response)); yield(); - cgCache.storeCache(cgeocaches.this, null, GCcode, listIdLFW, false, null); + cgCache.storeCache(cgeocaches.this, null, response, listIdLFW, false, null); - handler.sendMessage(handler.obtainMessage(2, GCcode)); + handler.sendMessage(handler.obtainMessage(2, response)); yield(); } else if ("RG".equals(response)) { //Server returned RG (registration) and this device no longer registered. diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java index a431359..b461cc2 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java +++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java @@ -130,9 +130,7 @@ public class GCConnector extends AbstractConnector { return searchResult; } - final SearchResult search = searchResult.filterSearchResults(false, false, Settings.getCacheType()); - - return search; + return searchResult.filterSearchResults(false, false, Settings.getCacheType()); } @Override diff --git a/main/src/cgeo/geocaching/connector/opencaching/ApiOpenCachingConnector.java b/main/src/cgeo/geocaching/connector/opencaching/ApiOpenCachingConnector.java index 8ed6acd..e4f382b 100644 --- a/main/src/cgeo/geocaching/connector/opencaching/ApiOpenCachingConnector.java +++ b/main/src/cgeo/geocaching/connector/opencaching/ApiOpenCachingConnector.java @@ -40,8 +40,6 @@ public class ApiOpenCachingConnector extends OpenCachingConnector { } final SearchResult searchResult = new SearchResult(); searchResult.addCache(cache); - - final SearchResult search = searchResult.filterSearchResults(false, false, Settings.getCacheType()); - return search; + return searchResult.filterSearchResults(false, false, Settings.getCacheType()); } } diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java index 17c7c0f..d3a7865 100644 --- a/main/src/cgeo/geocaching/maps/CachesOverlay.java +++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java @@ -171,8 +171,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { final Point left = new Point(); projection.toPixels(leftGeo, left); - final int radius = center.x - left.x; - return radius; + return center.x - left.x; } private void lazyInitializeDrawingObjects() { diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java b/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java index 6dfaf42..b659042 100644 --- a/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java +++ b/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java @@ -82,14 +82,12 @@ public class GoogleMapProvider implements MapProvider { @Override public CachesOverlayItemImpl getCachesOverlayItem(final IWaypoint coordinate, final CacheType type) { - GoogleCacheOverlayItem baseItem = new GoogleCacheOverlayItem(coordinate, type); - return baseItem; + return new GoogleCacheOverlayItem(coordinate, type); } @Override public OtherCachersOverlayItemImpl getOtherCachersOverlayItemBase(Context context, Go4CacheUser userOne) { - GoogleOtherCachersOverlayItem baseItem = new GoogleOtherCachersOverlayItem(context, userOne); - return baseItem; + return new GoogleOtherCachersOverlayItem(context, userOne); } } diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java index 2e0cc45..c119fd0 100644 --- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java +++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java @@ -83,14 +83,12 @@ public class MapsforgeMapProvider implements MapProvider { @Override public CachesOverlayItemImpl getCachesOverlayItem(final IWaypoint coordinate, final CacheType type) { - MapsforgeCacheOverlayItem baseItem = new MapsforgeCacheOverlayItem(coordinate, type); - return baseItem; + return new MapsforgeCacheOverlayItem(coordinate, type); } @Override public OtherCachersOverlayItemImpl getOtherCachersOverlayItemBase(Context context, Go4CacheUser userOne) { - MapsforgeOtherCachersOverlayItem baseItem = new MapsforgeOtherCachersOverlayItem(context, userOne); - return baseItem; + return new MapsforgeOtherCachersOverlayItem(context, userOne); } public static boolean isValidMapFile(String mapFileIn) { |