Mobile: implement follow mode

This commit is contained in:
fkloft
2013-12-23 21:53:25 +01:00
parent 51064a29c4
commit 78f6e07457
8 changed files with 82 additions and 11 deletions

View File

@ -25,6 +25,7 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener
private SensorManager mSensorManager = null;
private float[] mValuesGravity = null, mValuesGeomagnetic = null;
private double mOrientation = 0;
private boolean mFollowing = false;
public IITC_UserLocation(IITC_Mobile iitc) {
mIitc = iitc;
@ -95,6 +96,10 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener
return mLastLocation != null;
}
public boolean isFollowing() {
return mFollowing;
}
public void locate() {
// do not touch the javascript while iitc boots
if (mIitc.isLoading()) return;
@ -122,6 +127,15 @@ public class IITC_UserLocation implements LocationListener, SensorEventListener
updateListeners();
}
public void reset() {
setFollowMode(false);
}
public void setFollowMode(boolean follow) {
mFollowing = follow;
mIitc.invalidateOptionsMenu();
}
/**
* set the location mode to use. Available modes:
* 0: don't show user's position