added persistent zoom level option ( see https://plus.google.com/112875802603603993788/posts/K5zLYyAWQkE )
This commit is contained in:
@ -83,6 +83,7 @@ public class IITC_Mobile extends Activity
|
||||
private boolean mReloadNeeded = false;
|
||||
private boolean mIsLoading = true;
|
||||
private boolean mShowMapInDebug = false;
|
||||
private boolean mPersistentZoom = false;
|
||||
private final Stack<String> mDialogStack = new Stack<String>();
|
||||
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<String>(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
|
||||
|
@ -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() {
|
||||
|
Reference in New Issue
Block a user