diff options
| -rw-r--r-- | src/cgeo/geocaching/cgBase.java | 70 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgCache.java | 4 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgCacheListAdapter.java | 2 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgCompass.java | 16 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgCompassMini.java | 4 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgCoord.java | 4 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgDirection.java | 4 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgGeo.java | 6 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgeocaches.java | 4 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgeonavigate.java | 6 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgeopoint.java | 4 | ||||
| -rw-r--r-- | src/cgeo/geocaching/mapcommon/cgMapMyOverlay.java | 2 | ||||
| -rw-r--r-- | src/cgeo/geocaching/mapcommon/cgeomap.java | 4 |
13 files changed, 64 insertions, 66 deletions
diff --git a/src/cgeo/geocaching/cgBase.java b/src/cgeo/geocaching/cgBase.java index 2001a01..792b219 100644 --- a/src/cgeo/geocaching/cgBase.java +++ b/src/cgeo/geocaching/cgBase.java @@ -2642,9 +2642,9 @@ public class cgBase { while (matcher.find()) { if (matcher.groupCount() > 1) { if (matcher.group(2).equalsIgnoreCase("km") == true) { - distance = new Double(matcher.group(1)); + distance = Double.valueOf(matcher.group(1)); } else { - distance = new Double(matcher.group(1)) / kmInMiles; + distance = Double.valueOf(matcher.group(1)) / kmInMiles; } } } @@ -2673,7 +2673,7 @@ public class cgBase { } public static Double getHeading(Double lat1, Double lon1, Double lat2, Double lon2) { - Double result = new Double(0); + Double result = Double.valueOf(0); int ilat1 = (int) Math.round(0.5 + lat1 * 360000); int ilon1 = (int) Math.round(0.5 + lon1 * 360000); @@ -2686,21 +2686,21 @@ public class cgBase { lon2 *= deg2rad; if (ilat1 == ilat2 && ilon1 == ilon2) { - return new Double(result); + return Double.valueOf(result); } else if (ilat1 == ilat2) { if (ilon1 > ilon2) { - result = new Double(270); + result = Double.valueOf(270); } else { - result = new Double(90); + result = Double.valueOf(90); } } else if (ilon1 == ilon2) { if (ilat1 > ilat2) { - result = new Double(180); + result = Double.valueOf(180); } } else { Double c = Math.acos(Math.sin(lat2) * Math.sin(lat1) + Math.cos(lat2) * Math.cos(lat1) * Math.cos(lon2 - lon1)); Double A = Math.asin(Math.cos(lat2) * Math.sin(lon2 - lon1) / Math.sin(c)); - result = new Double(A * rad2deg); + result = Double.valueOf(A * rad2deg); if (ilat2 > ilat1 && ilon2 > ilon1) { // result don't need change } else if (ilat2 < ilat1 && ilon2 < ilon1) { @@ -2736,7 +2736,7 @@ public class cgBase { return "?"; } - return getHumanDistance(new Double(distance)); + return getHumanDistance(Double.valueOf(distance)); } public String getHumanDistance(Double distance) { @@ -2747,31 +2747,31 @@ public class cgBase { if (settings.units == cgSettings.unitsImperial) { distance *= kmInMiles; if (distance > 100) { - return String.format(Locale.getDefault(), "%.0f", new Double(Math.round(distance))) + " mi"; + return String.format(Locale.getDefault(), "%.0f", Double.valueOf(Math.round(distance))) + " mi"; } else if (distance > 0.5) { - return String.format(Locale.getDefault(), "%.1f", new Double(Math.round(distance * 10.0) / 10.0)) + " mi"; + return String.format(Locale.getDefault(), "%.1f", Double.valueOf(Math.round(distance * 10.0) / 10.0)) + " mi"; } else if (distance > 0.1) { - return String.format(Locale.getDefault(), "%.2f", new Double(Math.round(distance * 100.0) / 100.0)) + " mi"; + return String.format(Locale.getDefault(), "%.2f", Double.valueOf(Math.round(distance * 100.0) / 100.0)) + " mi"; } else if (distance > 0.05) { - return String.format(Locale.getDefault(), "%.0f", new Double(Math.round(distance * 5280.0))) + " ft"; + return String.format(Locale.getDefault(), "%.0f", Double.valueOf(Math.round(distance * 5280.0))) + " ft"; } else if (distance > 0.01) { - return String.format(Locale.getDefault(), "%.1f", new Double(Math.round(distance * 5280 * 10.0) / 10.0)) + " ft"; + return String.format(Locale.getDefault(), "%.1f", Double.valueOf(Math.round(distance * 5280 * 10.0) / 10.0)) + " ft"; } else { - return String.format(Locale.getDefault(), "%.2f", new Double(Math.round(distance * 5280 * 100.0) / 100.0)) + " ft"; + return String.format(Locale.getDefault(), "%.2f", Double.valueOf(Math.round(distance * 5280 * 100.0) / 100.0)) + " ft"; } } else { if (distance > 100) { - return String.format(Locale.getDefault(), "%.0f", new Double(Math.round(distance))) + " km"; + return String.format(Locale.getDefault(), "%.0f", Double.valueOf(Math.round(distance))) + " km"; } else if (distance > 10) { - return String.format(Locale.getDefault(), "%.1f", new Double(Math.round(distance * 10.0) / 10.0)) + " km"; + return String.format(Locale.getDefault(), "%.1f", Double.valueOf(Math.round(distance * 10.0) / 10.0)) + " km"; } else if (distance > 1) { - return String.format(Locale.getDefault(), "%.2f", new Double(Math.round(distance * 100.0) / 100.0)) + " km"; + return String.format(Locale.getDefault(), "%.2f", Double.valueOf(Math.round(distance * 100.0) / 100.0)) + " km"; } else if (distance > 0.1) { - return String.format(Locale.getDefault(), "%.0f", new Double(Math.round(distance * 1000.0))) + " m"; + return String.format(Locale.getDefault(), "%.0f", Double.valueOf(Math.round(distance * 1000.0))) + " m"; } else if (distance > 0.01) { - return String.format(Locale.getDefault(), "%.1f", new Double(Math.round(distance * 1000.0 * 10.0) / 10.0)) + " m"; + return String.format(Locale.getDefault(), "%.1f", Double.valueOf(Math.round(distance * 1000.0 * 10.0) / 10.0)) + " m"; } else { - return String.format(Locale.getDefault(), "%.2f", new Double(Math.round(distance * 1000.0 * 100.0) / 100.0)) + " m"; + return String.format(Locale.getDefault(), "%.2f", Double.valueOf(Math.round(distance * 1000.0 * 100.0) / 100.0)) + " m"; } } } @@ -2786,9 +2786,9 @@ public class cgBase { } if (kph < 10) { - return String.format(Locale.getDefault(), "%.1f", new Double((Math.round(kph * 10) / 10))) + " " + unit; + return String.format(Locale.getDefault(), "%.1f", Double.valueOf((Math.round(kph * 10) / 10))) + " " + unit; } else { - return String.format(Locale.getDefault(), "%.0f", new Double(Math.round(kph))) + " " + unit; + return String.format(Locale.getDefault(), "%.0f", Double.valueOf(Math.round(kph))) + " " + unit; } } @@ -2809,8 +2809,8 @@ public class cgBase { if (matcherLatlon.group(5).equalsIgnoreCase("E")) { lonNegative = 1; } - result.put("latitude", new Double(latNegative * (new Float(matcherLatlon.group(2)) + new Float(matcherLatlon.group(3) + "." + matcherLatlon.group(4)) / 60))); - result.put("longitude", new Double(lonNegative * (new Float(matcherLatlon.group(6)) + new Float(matcherLatlon.group(7) + "." + matcherLatlon.group(8)) / 60))); + result.put("latitude", Double.valueOf(latNegative * (Float.valueOf(matcherLatlon.group(2)) + Float.valueOf(matcherLatlon.group(3) + "." + matcherLatlon.group(4)) / 60))); + result.put("longitude", Double.valueOf(lonNegative * (Float.valueOf(matcherLatlon.group(6)) + Float.valueOf(matcherLatlon.group(7) + "." + matcherLatlon.group(8)) / 60))); } else { Log.w(cgSettings.tag, "cgBase.parseLatlon: Failed to parse coordinates."); } @@ -2891,10 +2891,10 @@ public class cgBase { } if (matcherA.groupCount() < 5 || matcherA.group(5) == null) { - coords.put("coordinate", new Double(latlonNegative * (new Double(matcherA.group(2)) + new Double(matcherA.group(3) + ".0") / 60))); + coords.put("coordinate", Double.valueOf(latlonNegative * (Double.valueOf(matcherA.group(2)) + Double.valueOf(matcherA.group(3) + ".0") / 60))); coords.put("string", matcherA.group(1) + " " + matcherA.group(2) + "° " + matcherA.group(3) + ".000"); } else { - coords.put("coordinate", new Double(latlonNegative * (new Double(matcherA.group(2)) + new Double(matcherA.group(3) + "." + matcherA.group(5)) / 60))); + coords.put("coordinate", Double.valueOf(latlonNegative * (Double.valueOf(matcherA.group(2)) + Double.valueOf(matcherA.group(3) + "." + matcherA.group(5)) / 60))); coords.put("string", matcherA.group(1) + " " + matcherA.group(2) + "° " + matcherA.group(3) + "." + matcherA.group(5)); } @@ -2907,15 +2907,15 @@ public class cgBase { } if (matcherB.groupCount() < 4 || matcherB.group(4) == null) { - coords.put("coordinate", new Double(latlonNegative * (new Double(matcherB.group(2) + ".0")))); + coords.put("coordinate", Double.valueOf(latlonNegative * (Double.valueOf(matcherB.group(2) + ".0")))); } else { - coords.put("coordinate", new Double(latlonNegative * (new Double(matcherB.group(2) + "." + matcherB.group(4))))); + coords.put("coordinate", Double.valueOf(latlonNegative * (Double.valueOf(matcherB.group(2) + "." + matcherB.group(4))))); } } else if (matcherC.find() == true && matcherC.groupCount() > 0) { if (matcherC.groupCount() < 3 || matcherC.group(3) == null) { - coords.put("coordinate", new Double(new Float(matcherC.group(1) + ".0"))); + coords.put("coordinate", Double.valueOf(new Float(matcherC.group(1) + ".0"))); } else { - coords.put("coordinate", new Double(new Float(matcherC.group(1) + "." + matcherC.group(3)))); + coords.put("coordinate", Double.valueOf(new Float(matcherC.group(1) + "." + matcherC.group(3)))); } } else if (matcherD.find() == true && matcherD.groupCount() > 0) { if (matcherD.group(1).equalsIgnoreCase("N") || matcherD.group(1).equalsIgnoreCase("E")) { @@ -2924,9 +2924,9 @@ public class cgBase { latlonNegative = -1; } - coords.put("coordinate", new Double(latlonNegative * (new Double(matcherB.group(2))))); + coords.put("coordinate", Double.valueOf(latlonNegative * (Double.valueOf(matcherB.group(2))))); } else if (matcherE.find() == true && matcherE.groupCount() > 0) { - coords.put("coordinate", new Double(matcherE.group(1))); + coords.put("coordinate", Double.valueOf(matcherE.group(1))); } else if (matcherF.find() == true && matcherF.groupCount() > 0) { if (matcherF.group(1).equalsIgnoreCase("N") || matcherF.group(1).equalsIgnoreCase("E")) { latlonNegative = 1; @@ -2934,7 +2934,7 @@ public class cgBase { latlonNegative = -1; } - coords.put("coordinate", new Double(latlonNegative * (new Double(matcherB.group(2))))); + coords.put("coordinate", Double.valueOf(latlonNegative * (Double.valueOf(matcherB.group(2))))); } else { return null; } @@ -4191,7 +4191,7 @@ public class cgBase { for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { - return inetAddress.getHostAddress().toString(); + return inetAddress.getHostAddress(); } } } diff --git a/src/cgeo/geocaching/cgCache.java b/src/cgeo/geocaching/cgCache.java index eb2b42d..5c635ca 100644 --- a/src/cgeo/geocaching/cgCache.java +++ b/src/cgeo/geocaching/cgCache.java @@ -27,8 +27,8 @@ public class cgCache { public Date hidden = null; public String hint = ""; public String size = ""; - public Float difficulty = new Float(0); - public Float terrain = new Float(0); + public Float difficulty = Float.valueOf(0); + public Float terrain = Float.valueOf(0); public Double direction = null; public Double distance = null; public String latlon = ""; diff --git a/src/cgeo/geocaching/cgCacheListAdapter.java b/src/cgeo/geocaching/cgCacheListAdapter.java index 5ed88a3..83470f5 100644 --- a/src/cgeo/geocaching/cgCacheListAdapter.java +++ b/src/cgeo/geocaching/cgCacheListAdapter.java @@ -50,7 +50,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { private boolean historic = false; private Double latitude = null; private Double longitude = null; - private Double azimuth = new Double(0); + private Double azimuth = Double.valueOf(0); private long lastSort = 0l; private boolean sort = true; private int checked = 0; diff --git a/src/cgeo/geocaching/cgCompass.java b/src/cgeo/geocaching/cgCompass.java index 5adf88c..f8abb69 100644 --- a/src/cgeo/geocaching/cgCompass.java +++ b/src/cgeo/geocaching/cgCompass.java @@ -23,10 +23,10 @@ public class cgCompass extends View { private Bitmap compassRose = null; private Bitmap compassArrow = null; private Bitmap compassOverlay = null; - private Double azimuth = new Double(0); - private Double heading = new Double(0); - private Double cacheHeading = new Double(0); - private Double northHeading = new Double(0); + private Double azimuth = Double.valueOf(0); + private Double heading = Double.valueOf(0); + private Double cacheHeading = Double.valueOf(0); + private Double northHeading = Double.valueOf(0); private PaintFlagsDrawFilter setfil = null; private PaintFlagsDrawFilter remfil = null; private int compassUnderlayWidth = 0; @@ -133,10 +133,10 @@ public class cgCompass extends View { lock = true; - Double diff = new Double(0); - Double diffAbs = new Double(0); - Double tempAzimuth = new Double(0); - Double tempHeading = new Double(0); + Double diff = Double.valueOf(0); + Double diffAbs = Double.valueOf(0); + Double tempAzimuth = Double.valueOf(0); + Double tempHeading = Double.valueOf(0); Double actualAzimuth = azimuth; Double actualHeading = heading; diff --git a/src/cgeo/geocaching/cgCompassMini.java b/src/cgeo/geocaching/cgCompassMini.java index e90045a..0f8607e 100644 --- a/src/cgeo/geocaching/cgCompassMini.java +++ b/src/cgeo/geocaching/cgCompassMini.java @@ -16,8 +16,8 @@ public class cgCompassMini extends View { private Double cacheLat = null; private Double cacheLon = null; private Bitmap compassArrow = null; - private Double azimuth = new Double(0); - private Double heading = new Double(0); + private Double azimuth = Double.valueOf(0); + private Double heading = Double.valueOf(0); private PaintFlagsDrawFilter setfil = null; private PaintFlagsDrawFilter remfil = null; diff --git a/src/cgeo/geocaching/cgCoord.java b/src/cgeo/geocaching/cgCoord.java index 4e7d3b2..3e3def3 100644 --- a/src/cgeo/geocaching/cgCoord.java +++ b/src/cgeo/geocaching/cgCoord.java @@ -9,8 +9,8 @@ public class cgCoord { public String name = ""; public boolean found = false; public boolean disabled = false; - public Double latitude = new Double(0); - public Double longitude = new Double(0); + public Double latitude = Double.valueOf(0); + public Double longitude = Double.valueOf(0); public Float difficulty = null; public Float terrain = null; public String size = null; diff --git a/src/cgeo/geocaching/cgDirection.java b/src/cgeo/geocaching/cgDirection.java index e99f898..3f30a29 100644 --- a/src/cgeo/geocaching/cgDirection.java +++ b/src/cgeo/geocaching/cgDirection.java @@ -63,9 +63,7 @@ public class cgDirection { @Override public void onSensorChanged(SensorEvent event) { - Double directionNowPre = new Double(event.values[0]); - - directionNow = Compatibility.getDirectionNow(directionNowPre, (Activity)context); + directionNow = Compatibility.getDirectionNow(Double.valueOf(event.values[0]), (Activity)context); if (dirUpdate != null && directionNow != null) { dirUpdate.updateDir(dir); diff --git a/src/cgeo/geocaching/cgGeo.java b/src/cgeo/geocaching/cgGeo.java index 0bdb5fb..407ca40 100644 --- a/src/cgeo/geocaching/cgGeo.java +++ b/src/cgeo/geocaching/cgGeo.java @@ -290,7 +290,7 @@ public class cgGeo { latitudeNow = lat; longitudeNow = lon; altitudeNow = null; - bearingNow = new Double(0); + bearingNow = Double.valueOf(0); speedNow = 0f; accuracyNow = 999f; @@ -326,9 +326,9 @@ public class cgGeo { altitudeNow = null; } if (location.hasBearing() && gps != -1) { - bearingNow = new Double(location.getBearing()); + bearingNow = Double.valueOf(location.getBearing()); } else { - bearingNow = new Double(0); + bearingNow = Double.valueOf(0); } if (location.hasSpeed() && gps != -1) { speedNow = location.getSpeed(); diff --git a/src/cgeo/geocaching/cgeocaches.java b/src/cgeo/geocaching/cgeocaches.java index 9bf03c4..9e2f2f3 100644 --- a/src/cgeo/geocaching/cgeocaches.java +++ b/src/cgeo/geocaching/cgeocaches.java @@ -136,7 +136,7 @@ public class cgeocaches extends AbstractListActivity { private View listFooter = null; private TextView listFooterText = null; private ProgressDialog waitDialog = null; - private Double northHeading = new Double(0); + private Double northHeading = Double.valueOf(0); private cgGeo geo = null; private cgDirection dir = null; private cgUpdateLoc geoUpdate = new update(); @@ -1631,7 +1631,7 @@ public class cgeocaches extends AbstractListActivity { if (geo.bearingNow != null) { adapter.setActualHeading(geo.bearingNow); } else { - adapter.setActualHeading(new Double(0)); + adapter.setActualHeading(Double.valueOf(0)); } } if (northHeading != null) { diff --git a/src/cgeo/geocaching/cgeonavigate.java b/src/cgeo/geocaching/cgeonavigate.java index e6c5462..7b1fd5c 100644 --- a/src/cgeo/geocaching/cgeonavigate.java +++ b/src/cgeo/geocaching/cgeonavigate.java @@ -30,8 +30,8 @@ public class cgeonavigate extends AbstractActivity { private cgUpdateDir dirUpdate = new UpdateDirection(); private Double dstLatitude = null; private Double dstLongitude = null; - private Double cacheHeading = new Double(0); - private Double northHeading = new Double(0); + private Double cacheHeading = Double.valueOf(0); + private Double northHeading = Double.valueOf(0); private String title = null; private String name = null; private TextView navType = null; @@ -418,7 +418,7 @@ public class cgeonavigate extends AbstractActivity { if (geo != null && geo.bearingNow != null) { northHeading = geo.bearingNow; } else { - northHeading = new Double(0); + northHeading = Double.valueOf(0); } } } catch (Exception e) { diff --git a/src/cgeo/geocaching/cgeopoint.java b/src/cgeo/geocaching/cgeopoint.java index 4e9fce9..40ceaf8 100644 --- a/src/cgeo/geocaching/cgeopoint.java +++ b/src/cgeo/geocaching/cgeopoint.java @@ -261,8 +261,8 @@ public class cgeopoint extends AbstractActivity { }); if (prefs.contains("anylatitude") == true && prefs.contains("anylongitude") == true) { - latitudeEdit.setText(cgBase.formatCoordinate(new Double(prefs.getFloat("anylatitude", 0f)), "lat", true)); - longitudeEdit.setText(cgBase.formatCoordinate(new Double(prefs.getFloat("anylongitude", 0f)), "lon", true)); + latitudeEdit.setText(cgBase.formatCoordinate(Double.valueOf(prefs.getFloat("anylatitude", 0f)), "lat", true)); + longitudeEdit.setText(cgBase.formatCoordinate(Double.valueOf(prefs.getFloat("anylongitude", 0f)), "lon", true)); } Button buttonCurrent = (Button) findViewById(R.id.current); diff --git a/src/cgeo/geocaching/mapcommon/cgMapMyOverlay.java b/src/cgeo/geocaching/mapcommon/cgMapMyOverlay.java index 708ad3e..ebaa6ce 100644 --- a/src/cgeo/geocaching/mapcommon/cgMapMyOverlay.java +++ b/src/cgeo/geocaching/mapcommon/cgMapMyOverlay.java @@ -24,7 +24,7 @@ public class cgMapMyOverlay implements OverlayBase { private cgSettings settings = null; private Location coordinates = null; private GeoPointImpl location = null; - private Double heading = new Double(0); + private Double heading = Double.valueOf(0); private Paint accuracyCircle = null; private Paint historyLine = null; private Paint historyLineShadow = null; diff --git a/src/cgeo/geocaching/mapcommon/cgeomap.java b/src/cgeo/geocaching/mapcommon/cgeomap.java index 9ea03e5..2322d3a 100644 --- a/src/cgeo/geocaching/mapcommon/cgeomap.java +++ b/src/cgeo/geocaching/mapcommon/cgeomap.java @@ -611,7 +611,7 @@ public class cgeomap extends MapBase { } }); - Float etaTime = new Float((detailTotal * (float) 7) / 60); + Float etaTime = Float.valueOf((detailTotal * (float) 7) / 60); if (etaTime < 0.4) { waitDialog.setMessage(res.getString(R.string.caches_downloading) + " " + res.getString(R.string.caches_eta_ltm)); } else if (etaTime < 1.5) { @@ -763,7 +763,7 @@ public class cgeomap extends MapBase { if (geo.bearingNow != null) { overlayMyLoc.setHeading(geo.bearingNow); } else { - overlayMyLoc.setHeading(new Double(0)); + overlayMyLoc.setHeading(Double.valueOf(0)); } } } catch (Exception e) { |
