From 561c81dd42c9ab5bcb490127c3d482a224a0f674 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 20:05:47 +0200 Subject: [PATCH] finish the editor activity only if another editor has been picked --- .../gallery/activities/EditActivity.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index 8ce60f1f5..ac8cdb4dc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -34,6 +34,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener var resizeWidth = 0 var resizeHeight = 0 var isCropIntent = false + var isEditingWithThirdParty = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -63,6 +64,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } + override fun onResume() { + super.onResume() + isEditingWithThirdParty = false + } + + override fun onStop() { + super.onStop() + if (isEditingWithThirdParty) + finish() + } + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_editor, menu) menu.findItem(R.id.resize).isVisible = !isCropIntent @@ -193,7 +205,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private fun editWith() { openEditor(uri, true) - finish() + isEditingWithThirdParty = true } private fun scanFinalPath(path: String) {