aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/maps
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2012-12-18 22:22:35 +0100
committerSamuel Tardieu <sam@rfc1149.net>2012-12-18 22:54:15 +0100
commitefa9888edd99e722628136b576fd1f081a13d910 (patch)
treede4b7a96ffe70e07914664d4a176a239e837ee9c /main/src/cgeo/geocaching/maps
parent6fe12bd37037dff96ac66a6fe903241f04c21497 (diff)
downloadcgeo-efa9888edd99e722628136b576fd1f081a13d910.zip
cgeo-efa9888edd99e722628136b576fd1f081a13d910.tar.gz
cgeo-efa9888edd99e722628136b576fd1f081a13d910.tar.bz2
Refactoring: narrow scope of variables
Diffstat (limited to 'main/src/cgeo/geocaching/maps')
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java5
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java3
-rw-r--r--main/src/cgeo/geocaching/maps/PositionOverlay.java9
3 files changed, 6 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 71d9c73..92018ea 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -578,9 +578,8 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
}
- MenuItem item;
try {
- item = menu.findItem(MENU_TRAIL_MODE); // show trail
+ MenuItem item = menu.findItem(MENU_TRAIL_MODE);
if (Settings.isMapTrail()) {
item.setTitle(res.getString(R.string.map_trail_hide));
} else {
@@ -751,9 +750,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
currentTheme = currentThemeFile.getName();
}
- int currentItem = 0;
List<String> names = new ArrayList<String>();
names.add(res.getString(R.string.map_theme_builtin));
+ int currentItem = 0;
for (File file : themeFiles) {
if (currentTheme.equalsIgnoreCase(file.getName())) {
currentItem = names.size();
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index e7c3903..044f69b 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -209,10 +209,9 @@ public class CachesOverlay extends AbstractItemizedOverlay {
progress.show(context, context.getResources().getString(R.string.map_live), context.getResources().getString(R.string.cache_dialog_loading_details), true, null);
- CachesOverlayItemImpl item = null;
-
// prevent concurrent changes
getOverlayImpl().lock();
+ CachesOverlayItemImpl item = null;
try {
if (index < items.size()) {
item = items.get(index);
diff --git a/main/src/cgeo/geocaching/maps/PositionOverlay.java b/main/src/cgeo/geocaching/maps/PositionOverlay.java
index 1aa2d3b..fec67ef 100644
--- a/main/src/cgeo/geocaching/maps/PositionOverlay.java
+++ b/main/src/cgeo/geocaching/maps/PositionOverlay.java
@@ -158,7 +158,6 @@ public class PositionOverlay implements GeneralOverlay {
if (Settings.isMapTrail()) {
int size = history.size();
if (size > 1) {
- int alpha;
int alphaCnt = size - 201;
if (alphaCnt < 1) {
alphaCnt = 1;
@@ -172,6 +171,7 @@ public class PositionOverlay implements GeneralOverlay {
projection.toPixels(mapItemFactory.getGeoPointBase(new Geopoint(prev)), historyPointP);
projection.toPixels(mapItemFactory.getGeoPointBase(new Geopoint(now)), historyPointN);
+ int alpha;
if ((alphaCnt - cnt) > 0) {
alpha = 255 / (alphaCnt - cnt);
}
@@ -211,11 +211,8 @@ public class PositionOverlay implements GeneralOverlay {
heightArrowHalf = arrow.getHeight() / 2;
}
- int marginLeft;
- int marginTop;
-
- marginLeft = center.x - widthArrowHalf;
- marginTop = center.y - heightArrowHalf;
+ int marginLeft = center.x - widthArrowHalf;
+ int marginTop = center.y - heightArrowHalf;
Matrix matrix = new Matrix();
matrix.setRotate(heading, widthArrowHalf, heightArrowHalf);