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:
Nazar 2019-07-04 18:56:12 +03:00
parent 4716f94500
commit 8bcfaa61a3
2 changed files with 10 additions and 2 deletions

View file

@ -1293,7 +1293,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
protected void onStart() {
super.onStart();
stopped = false;
lockHelper.setSensor(false); //switch off sensor when activity active
lockHelper.onStart();
getMyApplication().getNotificationHelper().showNotifications();
}
@ -1312,7 +1312,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
onPauseActivity();
}
stopped = true;
lockHelper.refreshSensorSettings();
lockHelper.onStop();
super.onStop();
}

View file

@ -144,6 +144,14 @@ public class LockHelper implements SensorEventListener {
setSensor(isSensorEnabled);
}
public void onStart() {
setSensor(false);
}
public void onStop() {
refreshSensorSettings();
}
public void setLockUIAdapter(LockUIAdapter adapter) {
lockUIAdapter = adapter;
}