From 74edee735ad9cd7d9b24df4a9a48d6dc9526fe47 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 2 Oct 2017 22:47:23 +0200 Subject: [PATCH] fix #381, handle media pick intents in Show All Folders content view --- .../gallery/activities/MainActivity.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 8a9da9d4a..b25521bb1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -252,9 +252,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { config.showAll = true Intent(this, MediaActivity::class.java).apply { putExtra(DIRECTORY, "/") - startActivity(this) + + if (mIsThirdPartyIntent) { + handleMediaIntent(this) + } else { + startActivity(this) + finish() + } } - finish() } private fun changeViewType() { @@ -477,7 +482,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun itemClicked(path: String) { Intent(this, MediaActivity::class.java).apply { putExtra(DIRECTORY, path) + handleMediaIntent(this) + } + } + private fun handleMediaIntent(intent: Intent) { + intent.apply { if (mIsSetWallpaperIntent) { putExtra(SET_WALLPAPER_INTENT, true) startActivityForResult(this, PICK_WALLPAPER)