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

View file

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