aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-05-08 19:20:00 +0200
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-10-11 23:57:16 +0200
commit00c7584480fc1682b2eac58778ed2a7fcb23acd9 (patch)
tree70905477147dcd7068ab7b483cc13d58d69c6ca7
parentd084c567262e1fb9a43e79aa25d4a08f80a0dd8b (diff)
downloadcgeo-00c7584480fc1682b2eac58778ed2a7fcb23acd9.zip
cgeo-00c7584480fc1682b2eac58778ed2a7fcb23acd9.tar.gz
cgeo-00c7584480fc1682b2eac58778ed2a7fcb23acd9.tar.bz2
Settings redone, removal second part
-rw-r--r--main/project.properties2
-rw-r--r--main/src/cgeo/geocaching/CgeoApplication.java5
-rw-r--r--main/src/cgeo/geocaching/sensors/Sensors.java13
-rw-r--r--main/src/cgeo/geocaching/settings/Settings.java40
4 files changed, 3 insertions, 57 deletions
diff --git a/main/project.properties b/main/project.properties
index 2ce3c6d..1adbda9 100644
--- a/main/project.properties
+++ b/main/project.properties
@@ -8,7 +8,7 @@
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:../play-services-base/proguard.txt:../play-services-location/proguard.txt
+proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-21
diff --git a/main/src/cgeo/geocaching/CgeoApplication.java b/main/src/cgeo/geocaching/CgeoApplication.java
index 847b520..34d7937 100644
--- a/main/src/cgeo/geocaching/CgeoApplication.java
+++ b/main/src/cgeo/geocaching/CgeoApplication.java
@@ -63,11 +63,6 @@ public class CgeoApplication extends Application {
// ensure initialization of lists
DataStore.getLists();
- // Check if Google Play services is available
- if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) {
- isGooglePlayServicesAvailable = true;
- }
- Log.i("Google Play services are " + (isGooglePlayServicesAvailable ? "" : "not ") + "available");
final Sensors sensors = Sensors.getInstance();
sensors.setupGeoDataObservables(Settings.useGooglePlayServices(), Settings.useLowPowerMode());
sensors.setupDirectionObservable(Settings.useLowPowerMode());
diff --git a/main/src/cgeo/geocaching/sensors/Sensors.java b/main/src/cgeo/geocaching/sensors/Sensors.java
index 6dc0ec2..0edba4b 100644
--- a/main/src/cgeo/geocaching/sensors/Sensors.java
+++ b/main/src/cgeo/geocaching/sensors/Sensors.java
@@ -68,17 +68,8 @@ public class Sensors {
};
public void setupGeoDataObservables(final boolean useGooglePlayServices, final boolean useLowPowerLocation) {
- if (useGooglePlayServices) {
- geoDataObservable = LocationProvider.getMostPrecise(app).onErrorResumeNext(fallbackToGeodataProvider).doOnNext(rememberGeodataAction);
- if (useLowPowerLocation) {
- geoDataObservableLowPower = LocationProvider.getLowPower(app).doOnNext(rememberGeodataAction).onErrorResumeNext(geoDataObservable);
- } else {
- geoDataObservableLowPower = geoDataObservable;
- }
- } else {
- geoDataObservable = RxUtils.rememberLast(GeoDataProvider.create(app).doOnNext(rememberGeodataAction), null);
- geoDataObservableLowPower = geoDataObservable;
- }
+ geoDataObservable = RxUtils.rememberLast(GeoDataProvider.create(app).doOnNext(rememberGeodataAction), null);
+ geoDataObservableLowPower = geoDataObservable;
}
private static final Func1<GeoData, Float> GPS_TO_DIRECTION = new Func1<GeoData, Float>() {
diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java
index 3e05efa..a865017 100644
--- a/main/src/cgeo/geocaching/settings/Settings.java
+++ b/main/src/cgeo/geocaching/settings/Settings.java
@@ -57,7 +57,6 @@ public class Settings {
private static final char HISTORY_SEPARATOR = ',';
public static final int SHOW_WP_THRESHOLD_DEFAULT = 10;
public static final int SHOW_WP_THRESHOLD_MAX = 50;
- private static final int MAP_SOURCE_DEFAULT = GoogleMapProvider.GOOGLE_MAP_ID.hashCode();
public static final boolean HW_ACCEL_DISABLED_BY_DEFAULT =
Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 ||
@@ -146,7 +145,6 @@ public class Settings {
e.putString(getKey(R.string.pref_webDeviceCode), prefsV0.getString(getKey(R.string.pref_webDeviceCode), null));
e.putString(getKey(R.string.pref_webDeviceName), prefsV0.getString(getKey(R.string.pref_webDeviceName), null));
e.putBoolean(getKey(R.string.pref_maplive), prefsV0.getInt(getKey(R.string.pref_maplive), 1) != 0);
- e.putInt(getKey(R.string.pref_mapsource), prefsV0.getInt(getKey(R.string.pref_mapsource), MAP_SOURCE_DEFAULT));
e.putBoolean(getKey(R.string.pref_twitter), 0 != prefsV0.getInt(getKey(R.string.pref_twitter), 0));
e.putBoolean(getKey(R.string.pref_showaddress), 0 != prefsV0.getInt(getKey(R.string.pref_showaddress), 1));
e.putBoolean(getKey(R.string.pref_showcaptcha), prefsV0.getBoolean(getKey(R.string.pref_showcaptcha), false));
@@ -211,9 +209,7 @@ public class Settings {
e.putInt(getKey(R.string.pref_showwaypointsthreshold), wpThreshold);
// KEY_MAP_SOURCE must be string, because it is the key for a ListPreference now
- final int ms = sharedPrefs.getInt(getKey(R.string.pref_mapsource), MAP_SOURCE_DEFAULT);
e.remove(getKey(R.string.pref_mapsource));
- e.putString(getKey(R.string.pref_mapsource), String.valueOf(ms));
// navigation tool ids must be string, because ListPreference uses strings as keys
final int dnt1 = sharedPrefs.getInt(getKey(R.string.pref_defaultNavigationTool), NavigationAppsEnum.COMPASS.id);
@@ -691,14 +687,6 @@ public class Settings {
if (mapSource != null) {
return mapSource;
}
- final int id = getConvertedMapId();
- mapSource = MapProviderFactory.getMapSource(id);
- if (mapSource != null) {
- // don't use offline maps if the map file is not valid
- if (!(mapSource instanceof OfflineMapSource) || isValidMapFile()) {
- return mapSource;
- }
- }
// fallback to first available map
return MapProviderFactory.getDefaultSource();
}
@@ -713,34 +701,6 @@ public class Settings {
private final static int OFFLINE = 4;
private static final int HISTORY_SIZE = 10;
- /**
- * Convert old preference ids for maps (based on constant values) into new hash based ids.
- */
- private static int getConvertedMapId() {
- final int id = Integer.parseInt(getString(R.string.pref_mapsource,
- String.valueOf(MAP_SOURCE_DEFAULT)));
- switch (id) {
- case GOOGLEMAP_BASEID + MAP:
- return GoogleMapProvider.GOOGLE_MAP_ID.hashCode();
- case GOOGLEMAP_BASEID + SATELLITE:
- return GoogleMapProvider.GOOGLE_SATELLITE_ID.hashCode();
- case MFMAP_BASEID + MAPNIK:
- return MapsforgeMapProvider.MAPSFORGE_MAPNIK_ID.hashCode();
- case MFMAP_BASEID + CYCLEMAP:
- return MapsforgeMapProvider.MAPSFORGE_CYCLEMAP_ID.hashCode();
- case MFMAP_BASEID + OFFLINE: {
- final String mapFile = Settings.getMapFile();
- if (StringUtils.isNotEmpty(mapFile)) {
- return mapFile.hashCode();
- }
- break;
- }
- default:
- break;
- }
- return id;
- }
-
public static synchronized void setMapSource(final MapSource newMapSource) {
putString(R.string.pref_mapsource, String.valueOf(newMapSource.getNumericalId()));
if (newMapSource instanceof OfflineMapSource) {