aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2011-11-19 20:09:30 +0100
committerBananeweizen <bananeweizen@gmx.de>2011-11-19 20:09:30 +0100
commit13cebd799c30d0542c44fdb4cdffbbef37cfa86c (patch)
tree2fb4a238a2ee370c150eeead8e28780b696d8325 /main/src
parentc1c685765acb471b3399046e3fc4c4cd415e015d (diff)
downloadcgeo-13cebd799c30d0542c44fdb4cdffbbef37cfa86c.zip
cgeo-13cebd799c30d0542c44fdb4cdffbbef37cfa86c.tar.gz
cgeo-13cebd799c30d0542c44fdb4cdffbbef37cfa86c.tar.bz2
fix several FindBugs warnings
* methods starting with uppercase letter * unused field and access methods * null value not explicitly given as null argument in method call * unnecessary math.floor()
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/Settings.java2
-rw-r--r--main/src/cgeo/geocaching/cgBase.java2
-rw-r--r--main/src/cgeo/geocaching/cgTrackable.java21
-rw-r--r--main/src/cgeo/geocaching/cgeoinit.java2
-rw-r--r--main/src/cgeo/geocaching/cgeotrackable.java7
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java4
-rw-r--r--main/src/cgeo/geocaching/maps/MapProviderFactory.java10
-rw-r--r--main/src/cgeo/geocaching/maps/ScaleOverlay.java2
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java4
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapView.java4
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/MapProvider.java2
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java2
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java2
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java2
-rw-r--r--main/src/cgeo/geocaching/network/OAuth.java2
15 files changed, 19 insertions, 49 deletions
diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java
index 822bd04..4d0fb01 100644
--- a/main/src/cgeo/geocaching/Settings.java
+++ b/main/src/cgeo/geocaching/Settings.java
@@ -678,7 +678,7 @@ public final class Settings {
}
public static void setMapSource(final int newMapSource) {
- if (!MapProviderFactory.IsSameProvider(getMapSource(), newMapSource)) {
+ if (!MapProviderFactory.isSameProvider(getMapSource(), newMapSource)) {
mapProvider = null;
}
editSharedSettings(new PrefRunnable() {
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java
index 8cab9c3..ff3f876 100644
--- a/main/src/cgeo/geocaching/cgBase.java
+++ b/main/src/cgeo/geocaching/cgBase.java
@@ -1924,7 +1924,7 @@ public class cgBase {
// if we have no geocode, we can't dynamically select the handler, but must explicitly use GC
if (geocode == null && guid != null) {
- return GCConnector.getInstance().searchByGeocode(geocode, guid, app, search, reason, handler);
+ return GCConnector.getInstance().searchByGeocode(null, guid, app, search, reason, handler);
}
return ConnectorFactory.getConnector(geocode).searchByGeocode(geocode, guid, app, search, reason, handler);
diff --git a/main/src/cgeo/geocaching/cgTrackable.java b/main/src/cgeo/geocaching/cgTrackable.java
index 5cde2f5..c37d411 100644
--- a/main/src/cgeo/geocaching/cgTrackable.java
+++ b/main/src/cgeo/geocaching/cgTrackable.java
@@ -1,7 +1,5 @@
package cgeo.geocaching;
-import cgeo.geocaching.enumerations.StatusCode;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -13,7 +11,6 @@ public class cgTrackable implements ILogable {
static final public int SPOTTED_UNKNOWN = 3;
static final public int SPOTTED_OWNER = 4;
- private StatusCode errorRetrieve = null;
private String error = "";
private String guid = "";
private String geocode = "";
@@ -37,28 +34,10 @@ public class cgTrackable implements ILogable {
return "http://coord.info/" + geocode.toUpperCase();
}
- public StatusCode getErrorRetrieve() {
- return errorRetrieve;
- }
-
- /*
- * unused
- * public void setErrorRetrieve(StatusCode errorRetrieve) {
- * this.errorRetrieve = errorRetrieve;
- * }
- */
-
public String getError() {
return error;
}
- /*
- * Unused
- * public void setError(String error) {
- * this.error = error;
- * }
- */
-
public String getGuid() {
return guid;
}
diff --git a/main/src/cgeo/geocaching/cgeoinit.java b/main/src/cgeo/geocaching/cgeoinit.java
index f5da14e..7b1731e 100644
--- a/main/src/cgeo/geocaching/cgeoinit.java
+++ b/main/src/cgeo/geocaching/cgeoinit.java
@@ -654,7 +654,7 @@ public class cgeoinit extends AbstractActivity {
}
}
- private class cgeoChangeMapSource implements OnItemSelectedListener {
+ private static class cgeoChangeMapSource implements OnItemSelectedListener {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
diff --git a/main/src/cgeo/geocaching/cgeotrackable.java b/main/src/cgeo/geocaching/cgeotrackable.java
index bcaa403..6258e2b 100644
--- a/main/src/cgeo/geocaching/cgeotrackable.java
+++ b/main/src/cgeo/geocaching/cgeotrackable.java
@@ -46,13 +46,6 @@ public class cgeotrackable extends AbstractActivity {
TextView itemName;
TextView itemValue;
- if (trackable != null && trackable.getErrorRetrieve() != null) {
- showToast(res.getString(R.string.err_tb_details_download) + " " + trackable.getErrorRetrieve().getErrorString(res) + ".");
-
- finish();
- return;
- }
-
if (trackable != null && StringUtils.isNotBlank(trackable.getError())) {
showToast(res.getString(R.string.err_tb_details_download) + " " + trackable.getError() + ".");
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 49d97ca..5a3b8b2 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -682,7 +682,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory
return true;
}
default:
- if (MapProviderFactory.IsValidSourceId(MapProviderFactory.getMapSourceFromMenuId(id))) {
+ if (MapProviderFactory.isValidSourceId(MapProviderFactory.getMapSourceFromMenuId(id))) {
item.setChecked(true);
int mapSource = MapProviderFactory.getMapSourceFromMenuId(id);
@@ -723,7 +723,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory
}
private boolean switchMapSource(int sourceId) {
- boolean mapRestartRequired = !MapProviderFactory.IsSameProvider(Settings.getMapSource(), sourceId);
+ boolean mapRestartRequired = !MapProviderFactory.isSameProvider(Settings.getMapSource(), sourceId);
Settings.setMapSource(sourceId);
diff --git a/main/src/cgeo/geocaching/maps/MapProviderFactory.java b/main/src/cgeo/geocaching/maps/MapProviderFactory.java
index 95be0f3..c7865f3 100644
--- a/main/src/cgeo/geocaching/maps/MapProviderFactory.java
+++ b/main/src/cgeo/geocaching/maps/MapProviderFactory.java
@@ -44,13 +44,13 @@ public class MapProviderFactory {
return getInstance().mapSources;
}
- public static boolean IsValidSourceId(int sourceId) {
+ public static boolean isValidSourceId(int sourceId) {
return getInstance().mapSources.containsKey(sourceId);
}
- public static boolean IsSameProvider(int sourceId1, int sourceId2) {
+ public static boolean isSameProvider(int sourceId1, int sourceId2) {
for (MapProvider mp : getInstance().mapProviders) {
- if (mp.IsMySource(sourceId1) && mp.IsMySource(sourceId2)) {
+ if (mp.isMySource(sourceId1) && mp.isMySource(sourceId2)) {
return true;
}
}
@@ -59,7 +59,7 @@ public class MapProviderFactory {
public static MapProvider getMapProvider(int sourceId) {
for (MapProvider mp : getInstance().mapProviders) {
- if (mp.IsMySource(sourceId)) {
+ if (mp.isMySource(sourceId)) {
return mp;
}
}
@@ -67,7 +67,6 @@ public class MapProviderFactory {
}
public static int getSourceOrdinalFromId(int sourceId) {
-
int sourceOrdinal = 0;
for (int key : getInstance().mapSources.keySet()) {
if (sourceId == key) {
@@ -90,7 +89,6 @@ public class MapProviderFactory {
}
public static void addMapviewMenuItems(Menu parentMenu, int groupId, int currentSource) {
-
SortedMap<Integer, String> mapSources = getInstance().mapSources;
for (int key : mapSources.keySet()) {
diff --git a/main/src/cgeo/geocaching/maps/ScaleOverlay.java b/main/src/cgeo/geocaching/maps/ScaleOverlay.java
index e4d4880..7f3deaa 100644
--- a/main/src/cgeo/geocaching/maps/ScaleOverlay.java
+++ b/main/src/cgeo/geocaching/maps/ScaleOverlay.java
@@ -130,7 +130,7 @@ public class ScaleOverlay implements GeneralOverlay {
scale.setTypeface(Typeface.DEFAULT_BOLD);
}
- if (mapView.NeedsInvertedColors()) {
+ if (mapView.needsInvertedColors()) {
scaleShadow.setColor(0xFF000000);
scale.setColor(0xFFFFFFFF);
} else {
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java b/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java
index 13373f1..7191428 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java
@@ -45,11 +45,11 @@ public class GoogleMapProvider implements MapProvider {
}
@Override
- public boolean IsMySource(int sourceId) {
+ public boolean isMySource(int sourceId) {
return sourceId >= baseId + MAP && sourceId <= baseId + SATELLITE;
}
- public static boolean IsSatelliteSource(int sourceId) {
+ public static boolean isSatelliteSource(int sourceId) {
MapProvider mp = MapProviderFactory.getMapProvider(sourceId);
if (mp instanceof GoogleMapProvider) {
GoogleMapProvider gp = (GoogleMapProvider) mp;
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
index 0cf135e..65e0ed1 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
@@ -142,7 +142,7 @@ public class GoogleMapView extends MapView implements MapViewImpl {
@Override
public void setMapSource() {
- setSatellite(GoogleMapProvider.IsSatelliteSource(Settings.getMapSource()));
+ setSatellite(GoogleMapProvider.isSatelliteSource(Settings.getMapSource()));
}
@Override
@@ -182,7 +182,7 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
@Override
- public boolean NeedsInvertedColors() {
+ public boolean needsInvertedColors() {
return false;
}
}
diff --git a/main/src/cgeo/geocaching/maps/interfaces/MapProvider.java b/main/src/cgeo/geocaching/maps/interfaces/MapProvider.java
index 96e725b..c2c46ac 100644
--- a/main/src/cgeo/geocaching/maps/interfaces/MapProvider.java
+++ b/main/src/cgeo/geocaching/maps/interfaces/MapProvider.java
@@ -21,7 +21,7 @@ public interface MapProvider {
public Map<Integer, String> getMapSources();
- public boolean IsMySource(int sourceId);
+ public boolean isMySource(int sourceId);
public Class<? extends Activity> getMapClass();
diff --git a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
index 13d9c65..ad35d26 100644
--- a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
+++ b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
@@ -77,6 +77,6 @@ public interface MapViewImpl {
*
* @return true - text/draw in light colors, false text/draw in dark colors
*/
- boolean NeedsInvertedColors();
+ boolean needsInvertedColors();
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
index b72f4ec..a51b04b 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
@@ -48,7 +48,7 @@ public class MapsforgeMapProvider implements MapProvider {
}
@Override
- public boolean IsMySource(int sourceId) {
+ public boolean isMySource(int sourceId) {
return sourceId >= baseId + MAPNIK && sourceId <= baseId + OFFLINE;
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
index 5da5612..9a64980 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
@@ -235,7 +235,7 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
@Override
- public boolean NeedsInvertedColors() {
+ public boolean needsInvertedColors() {
return false;
}
}
diff --git a/main/src/cgeo/geocaching/network/OAuth.java b/main/src/cgeo/geocaching/network/OAuth.java
index 38b04e9..9e0a703 100644
--- a/main/src/cgeo/geocaching/network/OAuth.java
+++ b/main/src/cgeo/geocaching/network/OAuth.java
@@ -18,7 +18,7 @@ public class OAuth {
"oauth_consumer_key", Settings.getKeyConsumerPublic(),
"oauth_nonce", CryptUtils.md5(Long.toString(System.currentTimeMillis())),
"oauth_signature_method", "HMAC-SHA1",
- "oauth_timestamp", Long.toString((long) Math.floor(new Date().getTime() / 1000)),
+ "oauth_timestamp", Long.toString(new Date().getTime() / 1000),
"oauth_token", StringUtils.defaultString(token),
"oauth_version", "1.0");
params.sort();