From 7f826712766fee3f873b7c2a3dd41efd0784ad22 Mon Sep 17 00:00:00 2001 From: fkloft Date: Mon, 23 Dec 2013 16:02:25 +0100 Subject: [PATCH 1/7] remove unused imports and fields; code formatting --- .../com/cradle/iitc_mobile/IITC_WebView.java | 26 ++++++++----------- .../iitc_mobile/async/CheckHttpResponse.java | 20 +++++--------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java index f5f9ac6f..00cd0464 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java @@ -2,7 +2,6 @@ package com.cradle.iitc_mobile; import android.annotation.SuppressLint; import android.annotation.TargetApi; -import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.net.ConnectivityManager; @@ -13,9 +12,6 @@ import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.WindowManager; -import android.webkit.ConsoleMessage; -import android.webkit.GeolocationPermissions; -import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.widget.Toast; @@ -70,17 +66,17 @@ public class IITC_WebView extends WebView { mNavHider = new Runnable() { @Override public void run() { - if (isInFullscreen() && (getFullscreenStatus() & (FS_NAVBAR)) != 0) { - int systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION; - // in immersive mode the user can interact with the app while the navbar is hidden - // this mode is available since KitKat - // you can leave this mode by swiping down from the top of the screen. this does only work - // when the app is in total-fullscreen mode - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && (mFullscreenStatus & FS_SYSBAR) != 0) { - systemUiVisibility |= SYSTEM_UI_FLAG_IMMERSIVE; + if (isInFullscreen() && (getFullscreenStatus() & (FS_NAVBAR)) != 0) { + int systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION; + // in immersive mode the user can interact with the app while the navbar is hidden + // this mode is available since KitKat + // you can leave this mode by swiping down from the top of the screen. this does only work + // when the app is in total-fullscreen mode + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && (mFullscreenStatus & FS_SYSBAR) != 0) { + systemUiVisibility |= SYSTEM_UI_FLAG_IMMERSIVE; + } + setSystemUiVisibility(systemUiVisibility); } - setSystemUiVisibility(systemUiVisibility); - } } }; @@ -131,7 +127,7 @@ public class IITC_WebView extends WebView { } // disable splash screen if a http error code is responded - new CheckHttpResponse(mJsInterface, mIitc).execute(url); + new CheckHttpResponse(mIitc).execute(url); Log.d("iitcm", "loading url: " + url); super.loadUrl(url); } diff --git a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java index dde6e89c..619c6c11 100644 --- a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java +++ b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java @@ -1,12 +1,10 @@ package com.cradle.iitc_mobile.async; import android.app.AlertDialog; -import android.content.Context; import android.content.DialogInterface; import android.os.AsyncTask; import android.util.Log; -import com.cradle.iitc_mobile.IITC_JSInterface; import com.cradle.iitc_mobile.IITC_Mobile; import org.apache.http.HttpResponse; @@ -24,12 +22,10 @@ import java.io.IOException; */ public class CheckHttpResponse extends AsyncTask { - private final IITC_JSInterface mJsInterface; - private final Context mContext; + private final IITC_Mobile mIitc; - public CheckHttpResponse(IITC_JSInterface jsInterface, Context c) { - mContext = c; - mJsInterface = jsInterface; + public CheckHttpResponse(IITC_Mobile iitc) { + mIitc = iitc; } @Override @@ -43,11 +39,10 @@ public class CheckHttpResponse extends AsyncTask { int code = response.getStatusLine().getStatusCode(); if (code != HttpStatus.SC_OK) { Log.d("iitcm", "received error code: " + code); - final IITC_Mobile iitc = (IITC_Mobile) mContext; - iitc.runOnUiThread(new Runnable() { + mIitc.runOnUiThread(new Runnable() { @Override public void run() { - iitc.setLoadingState(false); + mIitc.setLoadingState(false); } }); // TODO: remove when google login issue is fixed @@ -68,7 +63,7 @@ public class CheckHttpResponse extends AsyncTask { protected void onPostExecute(Boolean aBoolean) { if (aBoolean) { Log.d("iitcm", "google auth error, redirecting to work-around page"); - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mContext); + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mIitc); // set title alertDialogBuilder.setTitle("LOGIN FAILED!"); @@ -86,8 +81,7 @@ public class CheckHttpResponse extends AsyncTask { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); - IITC_Mobile iitc_mobile = (IITC_Mobile) mContext; - iitc_mobile.reloadIITC(); + mIitc.reloadIITC(); } }); From 2823450857dd8d15711d62226a6c81b169a9feac Mon Sep 17 00:00:00 2001 From: fkloft Date: Mon, 23 Dec 2013 20:35:19 +0100 Subject: [PATCH 2/7] mobile/user-location: Do not reload when switching between loc+sensor and loc-only --- mobile/plugins/user-location.user.js | 26 +++-- mobile/res/values/strings.xml | 16 ++- mobile/res/xml/preferences.xml | 46 ++++---- .../com/cradle/iitc_mobile/IITC_Mobile.java | 28 +++-- .../cradle/iitc_mobile/IITC_UserLocation.java | 106 +++++++++--------- .../iitc_mobile/fragments/MainSettings.java | 18 ++- 6 files changed, 130 insertions(+), 110 deletions(-) diff --git a/mobile/plugins/user-location.user.js b/mobile/plugins/user-location.user.js index 03cf5f7e..24a76147 100644 --- a/mobile/plugins/user-location.user.js +++ b/mobile/plugins/user-location.user.js @@ -94,13 +94,25 @@ window.plugin.userLocation.onLocationChange = function(lat, lng) { }; window.plugin.userLocation.onOrientationChange = function(direction) { - $(".container", window.plugin.userLocation.marker._icon) - .removeClass("circle") - .addClass("arrow") - .css({ - "transform": "rotate(" + direction + "deg)", - "webkitTransform": "rotate(" + direction + "deg)" - }); + var container = $(".container", window.plugin.userLocation.marker._icon); + + if(direction === null) { + container + .removeClass("arrow") + .addClass("circle") + .css({ + "transform": "", + "webkitTransform": "" + }); + } else { + container + .removeClass("circle") + .addClass("arrow") + .css({ + "transform": "rotate(" + direction + "deg)", + "webkitTransform": "rotate(" + direction + "deg)" + }); + } } var setup = window.plugin.userLocation.setup; diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index e6fb797d..3b5c6a26 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -83,11 +83,7 @@ Tweaks IITC Plugins Available plugins - User location - Display user location - Show users position on map - Use sensor orientation - Experimental! Fancier but eats battery packs for breakfast + Display user location on map Show zoom control Shows +/- buttons even on multitouch capable devices. Hide in fullscreen mode @@ -128,6 +124,16 @@ 8 16 + + Don\'t show user position + Show user position on map + Show user position and orientation on map + + + 0 + 1 + 2 + Clear Cookies Search diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index 089dcebc..7e6d0a8d 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -14,33 +14,26 @@ - - - - + + + + android:title="@string/pref_fullscreen"/> + - + android:title="@string/pref_external_storage"/> + android:defaultValue="false" + android:key="pref_press_twice_to_exit" + android:summary="@string/pref_press_twice_to_exit_sum" + android:title="@string/pref_press_twice_to_exit"/> - + \ No newline at end of file diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 97293ed7..c6d8d07f 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -88,8 +88,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis mIitcWebView.updateFullscreenStatus(); mUserLocation = new IITC_UserLocation(this); - mUserLocation.setLocationEnabled(mSharedPrefs.getBoolean("pref_user_loc", false)); - mUserLocation.setSensorEnabled(mSharedPrefs.getBoolean("pref_user_loc_sensor", true)); + mUserLocation.setLocationMode(Integer.parseInt(mSharedPrefs.getString("pref_user_location_mode", "0"))); // pass ActionBar to helper because we deprecated getActionBar mNavigationHelper = new IITC_NavigationHelper(this, super.getActionBar()); @@ -111,10 +110,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis if (key.equals("pref_force_desktop")) { mDesktopMode = sharedPreferences.getBoolean("pref_force_desktop", false); mNavigationHelper.onPrefChanged(); - } else if (key.equals("pref_user_loc")) { - mUserLocation.setLocationEnabled(sharedPreferences.getBoolean("pref_user_loc", false)); - } else if (key.equals("pref_user_loc_sensor")) { - mUserLocation.setSensorEnabled(sharedPreferences.getBoolean("pref_user_loc_sensor", true)); + } else if (key.equals("pref_user_location_mode")) { + int mode = Integer.parseInt(mSharedPrefs.getString("pref_user_location_mode", "0")); + if (mUserLocation.setLocationMode(mode)) + mReloadNeeded = true; + return; } else if (key.equals("pref_fullscreen")) { mIitcWebView.updateFullscreenStatus(); mNavigationHelper.onPrefChanged(); @@ -247,43 +247,41 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis protected void onStart() { super.onStart(); - // enough idle...let's do some work - Log.d("iitcm", "resuming...reset idleTimer"); - mUserLocation.onStart(); - if (mReloadNeeded) { Log.d("iitcm", "preference had changed...reload needed"); reloadIITC(); } else { // iitc is not fully booted...timer will be reset by the script itself if (findViewById(R.id.imageLoading).getVisibility() == View.GONE) { + // enough idle...let's do some work + Log.d("iitcm", "resuming...reset idleTimer"); mIitcWebView.loadUrl("javascript: window.idleReset();"); } } + + mUserLocation.onStart(); } @Override protected void onResume() { + super.onResume(); mIitcWebView.resumeTimers(); mIitcWebView.onResume(); - super.onResume(); } @Override protected void onPause() { + super.onPause(); mIitcWebView.pauseTimers(); mIitcWebView.onPause(); - super.onPause(); } @Override protected void onStop() { + super.onStop(); Log.d("iitcm", "stopping iitcm"); mIitcWebView.loadUrl("javascript: window.idleSet();"); - mUserLocation.onStop(); - - super.onStop(); } @Override diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java b/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java index de6834a8..dfa81c67 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java @@ -12,15 +12,15 @@ import android.os.Bundle; import android.view.Surface; public class IITC_UserLocation implements LocationListener, SensorEventListener { - private static final double SENSOR_DELAY_USER = 100*1e6; - private boolean mLocationEnabled = false; - private boolean mSensorEnabled = true; + private static final double SENSOR_DELAY_USER = 100 * 1e6; // 100 milliseconds + private int mMode = 0; + private boolean mRunning = false; + private boolean mLocationRegistered = false; + private boolean mOrientationRegistered = false; private long mLastUpdate = 0; private IITC_Mobile mIitc; private Location mLastLocation = null; private LocationManager mLocationManager; - private boolean mRegistered = false; - private boolean mRunning = false; private Sensor mSensorAccelerometer, mSensorMagnetometer; private SensorManager mSensorManager = null; float[] mValuesGravity = null, mValuesGeomagnetic = null; @@ -35,51 +35,44 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener mSensorMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); } - private void registerListeners() { - if (mRegistered) return; - mRegistered = true; + private void updateListeners() { + boolean useLocation = mRunning && mMode != 0; + boolean useOrientation = mRunning && mMode == 2; - try { - mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); - } catch (IllegalArgumentException e) { - // if the given provider doesn't exist - e.printStackTrace(); + if (useLocation && !mLocationRegistered) { + try { + mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); + } catch (IllegalArgumentException e) { + // if the given provider doesn't exist + e.printStackTrace(); + } + try { + mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); + } catch (IllegalArgumentException e) { + // if the given provider doesn't exist + e.printStackTrace(); + } + mLocationRegistered = true; } - try { - mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); - } catch (IllegalArgumentException e) { - // if the given provider doesn't exist - e.printStackTrace(); + if (!useLocation && mLocationRegistered) { + mLocationManager.removeUpdates(this); + mLocationRegistered = false; } - if (mSensorAccelerometer != null && mSensorMagnetometer != null && mSensorEnabled) { + if (useOrientation && !mOrientationRegistered && mSensorAccelerometer != null && mSensorMagnetometer != null) { mSensorManager.registerListener(this, mSensorAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); mSensorManager.registerListener(this, mSensorMagnetometer, SensorManager.SENSOR_DELAY_NORMAL); + mOrientationRegistered = true; } - } - - private void unregisterListeners() { - if (!mRegistered) return; - mRegistered = false; - - mLocationManager.removeUpdates(this); - - if (mSensorAccelerometer != null && mSensorMagnetometer != null && mSensorEnabled) { + if (!useOrientation && mOrientationRegistered && mSensorAccelerometer != null && mSensorMagnetometer != null) { mSensorManager.unregisterListener(this, mSensorAccelerometer); mSensorManager.unregisterListener(this, mSensorMagnetometer); + mOrientationRegistered = false; } - - } - - private void updateListeners() { - if (mRunning && mLocationEnabled) - registerListeners(); - else - unregisterListeners(); } public boolean hasCurrentLocation() { - if (!mRegistered) return false; + if (!mLocationRegistered) return false; return mLastLocation != null; } @@ -98,6 +91,12 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener public void onStart() { mRunning = true; updateListeners(); + + // in case we just switched from loc+sensor to loc-only, let javascript know + if (mMode == 1) { + mIitc.getWebView().loadJS("if(window.plugin && window.plugin.userLocation)" + + "window.plugin.userLocation.onOrientationChange(null);"); + } } public void onStop() { @@ -105,18 +104,19 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener updateListeners(); } - public void setLocationEnabled(boolean enabled) { - if (enabled == mLocationEnabled) return; + /** + * set the location mode to use. Available modes: + * 0: don't show user's position + * 1: show user's position + * 2: show user's position and orientation + * + * @return whether a reload is needed to reflect the changes made to the preferences + */ + public boolean setLocationMode(int mode) { + boolean needsReload = (mode == 0 && mMode != 0) || (mode != 0 && mMode == 0); + mMode = mode; - mLocationEnabled = enabled; - updateListeners(); - } - - public void setSensorEnabled(boolean enabled) { - if (enabled == mSensorEnabled) return; - - mSensorEnabled = enabled; - updateListeners(); + return needsReload; } // ------------------------------------------------------------------------ @@ -140,12 +140,10 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener @Override public void onProviderDisabled(String provider) { - } @Override public void onProviderEnabled(String provider) { - } @Override @@ -165,15 +163,15 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener @Override public void onSensorChanged(SensorEvent event) { - // save some battery 10 updates per second should be enough - if ((event.timestamp - mLastUpdate) < SENSOR_DELAY_USER) return; - mLastUpdate = event.timestamp; - if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) mValuesGravity = event.values; if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) mValuesGeomagnetic = event.values; + // save some battery, 10 updates per second should be enough + if ((event.timestamp - mLastUpdate) < SENSOR_DELAY_USER) return; + mLastUpdate = event.timestamp; + // do not touch the javascript while iitc boots if (mIitc.isLoading()) return; diff --git a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java index 77ccac2b..461e034b 100644 --- a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java +++ b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java @@ -6,6 +6,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.preference.EditTextPreference; +import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceFragment; @@ -54,6 +55,20 @@ public class MainSettings extends PreferenceFragment { // first init of summary String pref_iitc_source_sum = getString(R.string.pref_select_iitc_sum) + " " + pref_iitc_source.getText(); pref_iitc_source.setSummary(pref_iitc_source_sum); + + final ListPreference pref_user_location_mode = (ListPreference) findPreference("pref_user_location_mode"); + pref_user_location_mode.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + int mode = Integer.parseInt((String) newValue); + preference.setSummary(getResources().getStringArray(R.array.pref_user_location_titles)[mode]); + return true; + } + }); + + String value = getPreferenceManager().getSharedPreferences().getString("pref_user_location_mode", "0"); + int mode = Integer.parseInt(value); + pref_user_location_mode.setSummary(getResources().getStringArray(R.array.pref_user_location_titles)[mode]); } // we want a home button + HomeAsUpEnabled in nested preferences @@ -63,8 +78,7 @@ public class MainSettings extends PreferenceFragment { @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { if (preference.getTitle().toString().equals(getString(R.string.pref_advanced_options)) - || preference.getTitle().toString().equals(getString(R.string.pref_about_title)) - || preference.getTitle().toString().equals(getString(R.string.pref_user_loc_screen))) { + || preference.getTitle().toString().equals(getString(R.string.pref_about_title))) { initializeActionBar((PreferenceScreen) preference); } return super.onPreferenceTreeClick(preferenceScreen, preference); From 51064a29c43edd1e0179a1bb3704f7c8da3d6bae Mon Sep 17 00:00:00 2001 From: fkloft Date: Mon, 23 Dec 2013 21:16:34 +0100 Subject: [PATCH 3/7] Use CSS transition for arrow rotation --- mobile/plugins/user-location.css | 5 +++- .../cradle/iitc_mobile/IITC_UserLocation.java | 27 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/mobile/plugins/user-location.css b/mobile/plugins/user-location.css index 52d79f88..8890bdd8 100644 --- a/mobile/plugins/user-location.css +++ b/mobile/plugins/user-location.css @@ -5,8 +5,11 @@ .user-location .container { height: 32px; width: 32px; - transform-origin: center; + transform-origin: center; -webkit-transform-origin: center; + transition: all 200ms linear; + -moz-transition: all 200ms linear; + -webkit-transition: all 200ms linear; } .user-location .container .inner, diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java b/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java index dfa81c67..516f1589 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_UserLocation.java @@ -23,7 +23,8 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener private LocationManager mLocationManager; private Sensor mSensorAccelerometer, mSensorMagnetometer; private SensorManager mSensorManager = null; - float[] mValuesGravity = null, mValuesGeomagnetic = null; + private float[] mValuesGravity = null, mValuesGeomagnetic = null; + private double mOrientation = 0; public IITC_UserLocation(IITC_Mobile iitc) { mIitc = iitc; @@ -35,6 +36,24 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener mSensorMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); } + private void setOrientation(Double orientation) { + // we have a transition defined for the rotation + // changes to the orientation should always be less than 180° + + if (orientation != null) { + while (orientation < mOrientation - 180) + orientation += 360; + while (orientation > mOrientation + 180) + orientation -= 360; + mOrientation = orientation; + } else { + mOrientation = 0; + } + + mIitc.getWebView().loadJS("if(window.plugin && window.plugin.userLocation)" + + "window.plugin.userLocation.onOrientationChange(" + String.valueOf(orientation) + ");"); + } + private void updateListeners() { boolean useLocation = mRunning && mMode != 0; boolean useOrientation = mRunning && mMode == 2; @@ -94,8 +113,7 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener // in case we just switched from loc+sensor to loc-only, let javascript know if (mMode == 1) { - mIitc.getWebView().loadJS("if(window.plugin && window.plugin.userLocation)" - + "window.plugin.userLocation.onOrientationChange(null);"); + setOrientation(null); } } @@ -200,8 +218,7 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener break; } - mIitc.getWebView().loadJS("if(window.plugin && window.plugin.userLocation)" - + "window.plugin.userLocation.onOrientationChange(" + direction + ");"); + setOrientation(direction); } // From 78f6e07457624f7b5cde6557ef681945072d3d8f Mon Sep 17 00:00:00 2001 From: fkloft Date: Mon, 23 Dec 2013 21:53:25 +0100 Subject: [PATCH 4/7] Mobile: implement follow mode --- mobile/plugins/user-location.user.js | 28 ++++++++++++ .../ic_action_location_follow.png | Bin 0 -> 646 bytes .../ic_action_location_follow.png | Bin 0 -> 451 bytes .../ic_action_location_follow.png | Bin 0 -> 820 bytes .../ic_action_location_follow.png | Bin 0 -> 1236 bytes .../cradle/iitc_mobile/IITC_JSInterface.java | 10 +++++ .../com/cradle/iitc_mobile/IITC_Mobile.java | 41 +++++++++++++----- .../cradle/iitc_mobile/IITC_UserLocation.java | 14 ++++++ 8 files changed, 82 insertions(+), 11 deletions(-) create mode 100644 mobile/res/drawable-hdpi/ic_action_location_follow.png create mode 100644 mobile/res/drawable-mdpi/ic_action_location_follow.png create mode 100644 mobile/res/drawable-xhdpi/ic_action_location_follow.png create mode 100644 mobile/res/drawable-xxhdpi/ic_action_location_follow.png diff --git a/mobile/plugins/user-location.user.js b/mobile/plugins/user-location.user.js index 24a76147..c11ddf94 100644 --- a/mobile/plugins/user-location.user.js +++ b/mobile/plugins/user-location.user.js @@ -21,6 +21,7 @@ window.plugin.userLocation = function() {}; window.plugin.userLocation.locationLayer = new L.LayerGroup(); +window.plugin.userLocation.follow = false; window.plugin.userLocation.setup = function() { $('