Change sensor setup logic.
Now it activates only if enable in the settings and the screen is off while navigation. Remove router checkbox from preferences
This commit is contained in:
parent
4716f94500
commit
8bcfaa61a3
2 changed files with 10 additions and 2 deletions
|
@ -1293,7 +1293,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
stopped = false;
|
stopped = false;
|
||||||
lockHelper.setSensor(false); //switch off sensor when activity active
|
lockHelper.onStart();
|
||||||
getMyApplication().getNotificationHelper().showNotifications();
|
getMyApplication().getNotificationHelper().showNotifications();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1312,7 +1312,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
onPauseActivity();
|
onPauseActivity();
|
||||||
}
|
}
|
||||||
stopped = true;
|
stopped = true;
|
||||||
lockHelper.refreshSensorSettings();
|
lockHelper.onStop();
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,14 @@ public class LockHelper implements SensorEventListener {
|
||||||
setSensor(isSensorEnabled);
|
setSensor(isSensorEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onStart() {
|
||||||
|
setSensor(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onStop() {
|
||||||
|
refreshSensorSettings();
|
||||||
|
}
|
||||||
|
|
||||||
public void setLockUIAdapter(LockUIAdapter adapter) {
|
public void setLockUIAdapter(LockUIAdapter adapter) {
|
||||||
lockUIAdapter = adapter;
|
lockUIAdapter = adapter;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue