aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java19
-rw-r--r--main/src/cgeo/geocaching/CompassActivity.java7
-rw-r--r--main/src/cgeo/geocaching/Geocache.java13
-rw-r--r--main/src/cgeo/geocaching/IGeoData.java1
-rw-r--r--main/src/cgeo/geocaching/MainActivity.java7
-rw-r--r--main/src/cgeo/geocaching/cgData.java90
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java10
-rw-r--r--main/src/cgeo/geocaching/geopoint/Geopoint.java28
-rw-r--r--main/src/cgeo/geocaching/geopoint/Units.java12
-rw-r--r--main/src/cgeo/geocaching/settings/Settings.java10
-rw-r--r--main/src/cgeo/geocaching/settings/SettingsActivity.java1
11 files changed, 44 insertions, 154 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 1b31463..9dffeb2 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -160,24 +160,9 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
return;
}
- try {
- final StringBuilder dist = new StringBuilder();
-
- if (geo.getCoords() != null && cache != null && cache.getCoords() != null) {
- dist.append(Units.getDistanceFromKilometers(geo.getCoords().distanceTo(cache.getCoords())));
- }
-
- if (cache != null && cache.getElevation() != null) {
- if (geo.getAltitude() != 0.0) {
- final float diff = (float) (cache.getElevation() - geo.getAltitude());
- dist.append(' ').append(Units.getElevation(diff));
- }
- }
-
- cacheDistanceView.setText(dist.toString());
+ if (geo.getCoords() != null && cache != null && cache.getCoords() != null) {
+ cacheDistanceView.setText(Units.getDistanceFromKilometers(geo.getCoords().distanceTo(cache.getCoords())));
cacheDistanceView.bringToFront();
- } catch (final Exception e) {
- Log.w("Failed to update location.");
}
}
};
diff --git a/main/src/cgeo/geocaching/CompassActivity.java b/main/src/cgeo/geocaching/CompassActivity.java
index 8626173..a7e0f03 100644
--- a/main/src/cgeo/geocaching/CompassActivity.java
+++ b/main/src/cgeo/geocaching/CompassActivity.java
@@ -262,12 +262,7 @@ public class CompassActivity extends AbstractActivity {
navAccuracy.setText(null);
}
- if (geo.getAltitude() != 0.0f) {
- final String humanAlt = Units.getDistanceFromMeters((float) geo.getAltitude());
- navLocation.setText(geo.getCoords() + " | " + humanAlt);
- } else {
- navLocation.setText(geo.getCoords().toString());
- }
+ navLocation.setText(geo.getCoords().toString());
updateDistanceInfo(geo);
} else {
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index dd292f9..e6db8d5 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -86,7 +86,6 @@ public class Geocache implements ICache, IWaypoint {
private String location = null;
private Geopoint coords = null;
private boolean reliableLatLon = false;
- private Double elevation = null;
private String personalNote = null;
/**
* lazy initialized
@@ -279,9 +278,6 @@ public class Geocache implements ICache, IWaypoint {
if (coords == null) {
coords = other.coords;
}
- if (elevation == null) {
- elevation = other.elevation;
- }
// don't use StringUtils.isBlank here. Otherwise we cannot recognize a note which was deleted on GC
if (personalNote == null) {
personalNote = other.personalNote;
@@ -402,7 +398,6 @@ public class Geocache implements ICache, IWaypoint {
StringUtils.equalsIgnoreCase(cacheId, other.cacheId) &&
(direction != null ? direction.equals(other.direction) : null == other.direction) &&
(distance != null ? distance.equals(other.distance) : null == other.distance) &&
- (elevation != null ? elevation.equals(other.elevation) : null == other.elevation) &&
rating == other.rating &&
votes == other.votes &&
myVote == other.myVote &&
@@ -944,14 +939,6 @@ public class Geocache implements ICache, IWaypoint {
this.reliableLatLon = reliableLatLon;
}
- public Double getElevation() {
- return elevation;
- }
-
- public void setElevation(Double elevation) {
- this.elevation = elevation;
- }
-
public void setShortDescription(String shortdesc) {
this.shortdesc = shortdesc;
}
diff --git a/main/src/cgeo/geocaching/IGeoData.java b/main/src/cgeo/geocaching/IGeoData.java
index 252fd4f..c5ef698 100644
--- a/main/src/cgeo/geocaching/IGeoData.java
+++ b/main/src/cgeo/geocaching/IGeoData.java
@@ -13,7 +13,6 @@ public interface IGeoData {
public boolean isPseudoLocation();
public Geopoint getCoords();
- public double getAltitude();
public float getBearing();
public float getSpeed();
public float getAccuracy();
diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java
index 961217f..85ebe05 100644
--- a/main/src/cgeo/geocaching/MainActivity.java
+++ b/main/src/cgeo/geocaching/MainActivity.java
@@ -541,12 +541,7 @@ public class MainActivity extends AbstractActivity {
(new ObtainAddressThread()).start();
}
} else {
- if (geo.getAltitude() != 0.0) {
- final String humanAlt = Units.getDistanceFromKilometers((float) geo.getAltitude() / 1000);
- navLocation.setText(geo.getCoords() + " | " + humanAlt);
- } else {
- navLocation.setText(geo.getCoords().toString());
- }
+ navLocation.setText(geo.getCoords().toString());
}
} else {
if (nearestView.isClickable()) {
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index 2af2f82..ead698d 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -86,29 +86,28 @@ public class cgData {
"cg_caches.terrain," + // 18
"cg_caches.latlon," + // 19
"cg_caches.location," + // 20
- "cg_caches.elevation," + // 21
- "cg_caches.personal_note," + // 22
- "cg_caches.shortdesc," + // 23
- "cg_caches.favourite_cnt," + // 24
- "cg_caches.rating," + // 25
- "cg_caches.votes," + // 26
- "cg_caches.myvote," + // 27
- "cg_caches.disabled," + // 28
- "cg_caches.archived," + // 29
- "cg_caches.members," + // 30
- "cg_caches.found," + // 31
- "cg_caches.favourite," + // 32
- "cg_caches.inventoryunknown," + // 33
- "cg_caches.onWatchlist," + // 34
- "cg_caches.reliable_latlon," + // 35
- "cg_caches.coordsChanged," + // 36
- "cg_caches.latitude," + // 37
- "cg_caches.longitude," + // 38
- "cg_caches.finalDefined," + // 39
- "cg_caches._id," + // 40
- "cg_caches.inventorycoins," + // 41
- "cg_caches.inventorytags," + // 42
- "cg_caches.logPasswordRequired"; // 43
+ "cg_caches.personal_note," + // 21
+ "cg_caches.shortdesc," + // 22
+ "cg_caches.favourite_cnt," + // 23
+ "cg_caches.rating," + // 24
+ "cg_caches.votes," + // 25
+ "cg_caches.myvote," + // 26
+ "cg_caches.disabled," + // 27
+ "cg_caches.archived," + // 28
+ "cg_caches.members," + // 29
+ "cg_caches.found," + // 30
+ "cg_caches.favourite," + // 31
+ "cg_caches.inventoryunknown," + // 32
+ "cg_caches.onWatchlist," + // 33
+ "cg_caches.reliable_latlon," + // 34
+ "cg_caches.coordsChanged," + // 35
+ "cg_caches.latitude," + // 36
+ "cg_caches.longitude," + // 37
+ "cg_caches.finalDefined," + // 38
+ "cg_caches._id," + // 39
+ "cg_caches.inventorycoins," + // 40
+ "cg_caches.inventorytags," + // 41
+ "cg_caches.logPasswordRequired"; // 42
//TODO: remove "latlon" field from cache table
@@ -164,7 +163,6 @@ public class cgData {
+ "latitude double, "
+ "longitude double, "
+ "reliable_latlon integer, "
- + "elevation double, "
+ "personal_note text, "
+ "shortdesc text, "
+ "description text, "
@@ -580,7 +578,6 @@ public class cgData {
+ "latitude double, "
+ "longitude double, "
+ "reliable_latlon integer, "
- + "elevation double, "
+ "personal_note text, "
+ "shortdesc text, "
+ "description text, "
@@ -601,7 +598,7 @@ public class cgData {
db.execSQL(dbCreateCachesTemp);
db.execSQL("insert into " + dbTableCachesTemp + " select _id,updated,detailed,detailedupdate,visiteddate,geocode,reason,cacheid,guid,type,name,own,owner,owner_real," +
- "hidden,hint,size,difficulty,terrain,latlon,location,direction,distance,latitude,longitude, 0,elevation," +
+ "hidden,hint,size,difficulty,terrain,latlon,location,direction,distance,latitude,longitude, 0," +
"personal_note,shortdesc,description,favourite_cnt,rating,votes,myvote,disabled,archived,members,found,favourite,inventorycoins," +
"inventorytags,inventoryunknown,onWatchlist from " + dbTableCaches);
db.execSQL("drop table " + dbTableCaches);
@@ -1082,7 +1079,6 @@ public class cgData {
values.put("direction", cache.getDirection());
putCoords(values, cache.getCoords());
values.put("reliable_latlon", cache.isReliableLatLon() ? 1 : 0);
- values.put("elevation", cache.getElevation());
values.put("shortdesc", cache.getShortDescription());
values.put("personal_note", cache.getPersonalNote());
values.put("description", cache.getDescription());
@@ -1656,31 +1652,25 @@ public class cgData {
}
cache.setTerrain(cursor.getFloat(18));
// do not set cache.location
- cache.setCoords(getCoords(cursor, 37, 38));
- index = 21;
- if (cursor.isNull(index)) {
- cache.setElevation(null);
- } else {
- cache.setElevation(cursor.getDouble(index));
- }
- cache.setPersonalNote(cursor.getString(22));
+ cache.setCoords(getCoords(cursor, 36, 37));
+ cache.setPersonalNote(cursor.getString(21));
// do not set cache.shortdesc
// do not set cache.description
- cache.setFavoritePoints(cursor.getInt(24));
- cache.setRating(cursor.getFloat(25));
- cache.setVotes(cursor.getInt(26));
- cache.setMyVote(cursor.getFloat(27));
- cache.setDisabled(cursor.getInt(28) == 1);
- cache.setArchived(cursor.getInt(29) == 1);
- cache.setPremiumMembersOnly(cursor.getInt(30) == 1);
- cache.setFound(cursor.getInt(31) == 1);
- cache.setFavorite(cursor.getInt(32) == 1);
- cache.setInventoryItems(cursor.getInt(33));
- cache.setOnWatchlist(cursor.getInt(34) == 1);
- cache.setReliableLatLon(cursor.getInt(35) > 0);
- cache.setUserModifiedCoords(cursor.getInt(36) > 0);
- cache.setFinalDefined(cursor.getInt(39) > 0);
- cache.setLogPasswordRequired(cursor.getInt(43) > 0);
+ cache.setFavoritePoints(cursor.getInt(23));
+ cache.setRating(cursor.getFloat(24));
+ cache.setVotes(cursor.getInt(25));
+ cache.setMyVote(cursor.getFloat(26));
+ cache.setDisabled(cursor.getInt(27) == 1);
+ cache.setArchived(cursor.getInt(28) == 1);
+ cache.setPremiumMembersOnly(cursor.getInt(29) == 1);
+ cache.setFound(cursor.getInt(30) == 1);
+ cache.setFavorite(cursor.getInt(31) == 1);
+ cache.setInventoryItems(cursor.getInt(32));
+ cache.setOnWatchlist(cursor.getInt(33) == 1);
+ cache.setReliableLatLon(cursor.getInt(34) > 0);
+ cache.setUserModifiedCoords(cursor.getInt(35) > 0);
+ cache.setFinalDefined(cursor.getInt(38) > 0);
+ cache.setLogPasswordRequired(cursor.getInt(42) > 0);
Log.d("Loading " + cache.toString() + " (" + cache.getListId() + ") from DB");
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index ea15633..9ecb51b 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -1756,16 +1756,6 @@ public abstract class GCParser {
}
}
- if (Settings.isElevationWanted()) {
- if (CancellableHandler.isCancelled(handler)) {
- return;
- }
- CancellableHandler.sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_elevation);
- if (cache.getCoords() != null) {
- cache.setElevation(cache.getCoords().getElevation());
- }
- }
-
if (Settings.isRatingWanted()) {
if (CancellableHandler.isCancelled(handler)) {
return;
diff --git a/main/src/cgeo/geocaching/geopoint/Geopoint.java b/main/src/cgeo/geocaching/geopoint/Geopoint.java
index 1973b03..11f03cb 100644
--- a/main/src/cgeo/geocaching/geopoint/Geopoint.java
+++ b/main/src/cgeo/geocaching/geopoint/Geopoint.java
@@ -323,34 +323,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
}
}
- public Double getElevation() {
- try {
- final String uri = "http://maps.googleapis.com/maps/api/elevation/json";
- final Parameters params = new Parameters(
- "sensor", "false",
- "locations", format(Format.LAT_LON_DECDEGREE_COMMA));
- final JSONObject response = Network.requestJSON(uri, params);
-
- if (response == null) {
- return null;
- }
-
- if (!StringUtils.equalsIgnoreCase(response.getString("status"), "OK")) {
- return null;
- }
-
- if (response.has("results")) {
- JSONArray results = response.getJSONArray("results");
- JSONObject result = results.getJSONObject(0);
- return result.getDouble("elevation");
- }
- } catch (Exception e) {
- Log.w("Geopoint.getElevation", e);
- }
-
- return null;
- }
-
@Override
public Geopoint getCoords() {
return this;
diff --git a/main/src/cgeo/geocaching/geopoint/Units.java b/main/src/cgeo/geocaching/geopoint/Units.java
index 75d71d0..b99e00e 100644
--- a/main/src/cgeo/geocaching/geopoint/Units.java
+++ b/main/src/cgeo/geocaching/geopoint/Units.java
@@ -47,18 +47,6 @@ public class Units {
return String.format(formatString + " %s", scaled.left, scaled.right);
}
- /**
- * Get human readable elevation, depending on settings for metric units.
- * Result is rounded to full meters/feet, as the sensors don't have that precision anyway.
- *
- * @param meters
- * @return
- */
- public static String getElevation(float meters) {
- final ImmutablePair<Double, String> scaled = scaleDistance(meters / 1000f);
- return (meters >= 0 ? "↥ " : "↧ ") + String.format("%d %s", Math.abs(Math.round(scaled.left)), scaled.right);
- }
-
public static String getDistanceFromMeters(float meters) {
return getDistanceFromKilometers(meters / 1000f);
}
diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java
index 20bbf22..775b699 100644
--- a/main/src/cgeo/geocaching/settings/Settings.java
+++ b/main/src/cgeo/geocaching/settings/Settings.java
@@ -117,13 +117,11 @@ public final class Settings {
e.putInt(getKey(R.string.pref_version), old.getInt(getKey(R.string.pref_version), 0));
e.putBoolean(getKey(R.string.pref_autoloaddesc), 0 != old.getInt(getKey(R.string.pref_autoloaddesc), 1));
e.putBoolean(getKey(R.string.pref_ratingwanted), old.getBoolean(getKey(R.string.pref_ratingwanted), true));
- e.putBoolean(getKey(R.string.pref_elevationwanted), old.getBoolean(getKey(R.string.pref_elevationwanted), false));
e.putBoolean(getKey(R.string.pref_friendlogswanted), old.getBoolean(getKey(R.string.pref_friendlogswanted), true));
e.putBoolean(getKey(R.string.pref_useenglish), old.getBoolean(getKey(R.string.pref_useenglish), false));
e.putBoolean(getKey(R.string.pref_usecompass), 0 != old.getInt(getKey(R.string.pref_usecompass), 1));
e.putBoolean(getKey(R.string.pref_trackautovisit), old.getBoolean(getKey(R.string.pref_trackautovisit), false));
e.putBoolean(getKey(R.string.pref_sigautoinsert), old.getBoolean(getKey(R.string.pref_sigautoinsert), false));
- e.putInt(getKey(R.string.pref_altcorrection), old.getInt(getKey(R.string.pref_altcorrection), 0));
e.putBoolean(getKey(R.string.pref_logimages), old.getBoolean(getKey(R.string.pref_logimages), false));
e.putBoolean(getKey(R.string.pref_excludedisabled), 0 != old.getInt(getKey(R.string.pref_excludedisabled), 0));
e.putBoolean(getKey(R.string.pref_excludemine), 0 != old.getInt(getKey(R.string.pref_excludemine), 0));
@@ -527,10 +525,6 @@ public final class Settings {
return getBoolean(R.string.pref_ratingwanted, true);
}
- public static boolean isElevationWanted() {
- return getBoolean(R.string.pref_elevationwanted, false);
- }
-
public static boolean isFriendLogsWanted() {
if (!isLogin()) {
// don't show a friends log if the user is anonymous
@@ -693,10 +687,6 @@ public final class Settings {
return keyConsumerSecret;
}
- public static int getAltitudeCorrection() {
- return getInt(R.string.pref_altcorrection, 0);
- }
-
public static String getWebDeviceCode() {
return getString(R.string.pref_webDeviceCode, null);
}
diff --git a/main/src/cgeo/geocaching/settings/SettingsActivity.java b/main/src/cgeo/geocaching/settings/SettingsActivity.java
index d6bd550..ad8d9d3 100644
--- a/main/src/cgeo/geocaching/settings/SettingsActivity.java
+++ b/main/src/cgeo/geocaching/settings/SettingsActivity.java
@@ -130,7 +130,6 @@ public class SettingsActivity extends PreferenceActivity {
R.string.pref_fakekey_preference_backup_info, }) {
bindSummaryToStringValue(this, getKey(k));
}
- bindSummaryToIntValue(this, getKey(R.string.pref_altcorrection));
}
private static String getKey(final int prefKeyId) {