From 5a4b6065fb0294d29ed19ee3bf369170537e0972 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 2 Jun 2017 21:57:31 +0200 Subject: [PATCH] fix #270, temporarily show hidden files when opening a third party intent --- .../gallery/activities/PhotoVideoActivity.kt | 2 ++ .../gallery/activities/ViewPagerActivity.kt | 11 +++++++++++ .../simplemobiletools/gallery/helpers/Constants.kt | 1 + 3 files changed, 14 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 06c4d890a..56e39f852 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -21,6 +21,7 @@ import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.fragments.PhotoFragment import com.simplemobiletools.gallery.fragments.VideoFragment import com.simplemobiletools.gallery.fragments.ViewPagerFragment +import com.simplemobiletools.gallery.helpers.IS_VIEW_INTENT import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* @@ -119,6 +120,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun sendViewPagerIntent(path: String) { Intent(this, ViewPagerActivity::class.java).apply { + putExtra(IS_VIEW_INTENT, true) putExtra(MEDIUM, path) startActivity(this) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index a8f4c20f0..4862f84f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -90,6 +90,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } + if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { + config.temporarilyShowHidden = true + } + mMedia = ArrayList() showSystemUI() @@ -107,6 +111,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View view_pager.background = ColorDrawable(Color.BLACK) } + override fun onDestroy() { + super.onDestroy() + if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { + config.temporarilyShowHidden = false + } + } + private fun setupOrientationEventListener() { mOrientationEventListener = object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) { override fun onOrientationChanged(orientation: Int) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 5ebaa98a6..0a3b1ef3e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -33,6 +33,7 @@ val GET_VIDEO_INTENT = "get_video_intent" val GET_ANY_INTENT = "get_any_intent" val SET_WALLPAPER_INTENT = "set_wallpaper_intent" val DIRECTORIES = "directories2" +val IS_VIEW_INTENT = "is_view_intent" val REQUEST_EDIT_IMAGE = 1 val REQUEST_SET_WALLPAPER = 2