diff --git a/mobile/plugins/user-location.user.js b/mobile/plugins/user-location.user.js
index 93895a6a..23ec3296 100644
--- a/mobile/plugins/user-location.user.js
+++ b/mobile/plugins/user-location.user.js
@@ -75,7 +75,7 @@ window.plugin.userLocation.onZoomEnd = function() {
}
};
-window.plugin.userLocation.locate = function(lat, lng, accuracy) {
+window.plugin.userLocation.locate = function(lat, lng, accuracy, persistentZoom) {
if(window.plugin.userLocation.follow) {
window.plugin.userLocation.follow = false;
if(typeof android !== 'undefined' && android && android.setFollowMode)
@@ -94,7 +94,7 @@ window.plugin.userLocation.locate = function(lat, lng, accuracy) {
// an extremely close view is pretty pointless (especially with maps that support zoom level 20+)
// so limit to 17 (enough to see all portals)
- zoom = Math.min(zoom,17);
+ zoom = (persistentZoom) ? map.getZoom() : Math.min(zoom,17);
if(window.map.getCenter().distanceTo(latlng) < 10) {
window.plugin.userLocation.follow = true;
diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml
index bbbb5fb8..ed36fa12 100644
--- a/mobile/res/values/strings.xml
+++ b/mobile/res/values/strings.xml
@@ -105,6 +105,8 @@
Plugins extend/modify the IITC experience. Most plugins known from desktop IITC can be found here.
Available plugins
Display user location on map
+ Persistent zoom level
+ Don\'t change zoom level when locate button is pressed
Show zoom control
Shows +/- buttons even on multitouch capable devices.
Hide in fullscreen mode
diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml
index c3d8e6ef..8e3548c1 100644
--- a/mobile/res/xml/preferences.xml
+++ b/mobile/res/xml/preferences.xml
@@ -61,6 +61,11 @@
android:key="pref_press_twice_to_exit"
android:summary="@string/pref_press_twice_to_exit_sum"
android:title="@string/pref_press_twice_to_exit"/>
+
mDialogStack = new Stack();
private String mPermalink = null;
private String mSearchTerm = null;
@@ -143,6 +144,8 @@ public class IITC_Mobile extends Activity
final String[] menuDefaults = getResources().getStringArray(R.array.pref_android_menu_default);
mAdvancedMenu = mSharedPrefs.getStringSet("pref_android_menu", new HashSet(Arrays.asList(menuDefaults)));
+ mPersistentZoom = mSharedPrefs.getBoolean("pref_persistent_zoom", false);
+
// get fullscreen status from settings
mIitcWebView.updateFullscreenStatus();
@@ -180,6 +183,9 @@ public class IITC_Mobile extends Activity
if (mUserLocation.setLocationMode(mode))
mReloadNeeded = true;
return;
+ } else if (key.equals("pref_persistent_zoom")) {
+ mPersistentZoom = mSharedPrefs.getBoolean("pref_persistent_zoom", false);
+ return;
} else if (key.equals("pref_fullscreen")) {
mIitcWebView.updateFullscreenStatus();
mNavigationHelper.onPrefChanged();
@@ -570,10 +576,11 @@ public class IITC_Mobile extends Activity
if (mUserLocation.hasCurrentLocation()) {
// if gps location is displayed we can use a better location without any costs
- mUserLocation.locate();
+ mUserLocation.locate(mPersistentZoom);
} else {
// get location from network by default
- mIitcWebView.loadUrl("javascript: window.map.locate({setView : true});");
+ mIitcWebView.loadUrl("javascript: window.map.locate({setView : true" +
+ (mPersistentZoom ? ", maxZoom : map.getZoom()" : "") + "});");
}
return true;
case R.id.action_settings: // start settings activity
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java b/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java
index 429fb214..498e8c15 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java
@@ -100,7 +100,7 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener
return mFollowing;
}
- public void locate() {
+ public void locate(final boolean persistentZoom) {
// do not touch the javascript while iitc boots
if (mIitc.isLoading()) return;
@@ -109,7 +109,8 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener
mIitc.getWebView().loadJS("if(window.plugin && window.plugin.userLocation)"
+ "window.plugin.userLocation.locate("
- + location.getLatitude() + ", " + location.getLongitude() + ", " + location.getAccuracy() + ");");
+ + location.getLatitude() + ", " + location.getLongitude() + ", "
+ + location.getAccuracy() + ", " + persistentZoom + ");");
}
public void onStart() {