mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-06-27 09:02:59 +02:00
stop orientation checking if the activity is destroyed
This commit is contained in:
@ -506,6 +506,11 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
|||||||
private fun setupOrientationEventListener() {
|
private fun setupOrientationEventListener() {
|
||||||
mOrientationEventListener = object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
|
mOrientationEventListener = object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
|
||||||
override fun onOrientationChanged(orientation: Int) {
|
override fun onOrientationChanged(orientation: Int) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed) {
|
||||||
|
mOrientationEventListener.disable()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val currOrient = if (orientation in 45..134) {
|
val currOrient = if (orientation in 45..134) {
|
||||||
ORIENT_LANDSCAPE_RIGHT
|
ORIENT_LANDSCAPE_RIGHT
|
||||||
} else if (orientation in 225..314) {
|
} else if (orientation in 225..314) {
|
||||||
|
Reference in New Issue
Block a user