This commit is contained in:
Nazar 2019-07-04 19:21:43 +03:00
parent 896d83c088
commit 7ee5187100
2 changed files with 15 additions and 7 deletions

View file

@ -1293,7 +1293,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
protected void onStart() {
super.onStart();
stopped = false;
lockHelper.onStart();
lockHelper.onStart(this);
getMyApplication().getNotificationHelper().showNotifications();
}
@ -1312,7 +1312,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
onPauseActivity();
}
stopped = true;
lockHelper.onStop();
lockHelper.onStop(this);
super.onStop();
}
@ -1415,7 +1415,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
getMapView().refreshMap(true);
}
});
lockHelper.refreshRouterSettings();
getMapView().refreshMap(true);
}

View file

@ -1,5 +1,6 @@
package net.osmand.plus.helpers;
import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
@ -58,6 +59,8 @@ public class LockHelper implements SensorEventListener {
unlockEvent();
}
};
refreshRouterSettings();
}
private void releaseWakeLocks() {
@ -144,12 +147,18 @@ public class LockHelper implements SensorEventListener {
setSensor(isSensorEnabled);
}
public void onStart() {
setSensor(false);
public void onStart(Activity a) {
if (wakeLock == null) {
setSensor(false);
setVoiceRouterListener(false);
}
}
public void onStop() {
refreshSensorSettings();
public void onStop(Activity a) {
if(!a.isFinishing()) {
refreshRouterSettings();
refreshSensorSettings();
}
}
public void setLockUIAdapter(LockUIAdapter adapter) {