Skip to content

Commit b761501

Browse files
committed
stop orientation checking if the activity is destroyed
1 parent 7acdcd6 commit b761501

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
506506
private fun setupOrientationEventListener() {
507507
mOrientationEventListener = object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
508508
override fun onOrientationChanged(orientation: Int) {
509+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed) {
510+
mOrientationEventListener.disable()
511+
return
512+
}
513+
509514
val currOrient = if (orientation in 45..134) {
510515
ORIENT_LANDSCAPE_RIGHT
511516
} else if (orientation in 225..314) {

0 commit comments

Comments
 (0)