From b421dc273fe7f41e557245e942bbb332d4b04fc8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 11:41:31 +0100 Subject: [PATCH] replace MEDIUM constant with PATH in some intents --- .../simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 3 ++- .../gallery/activities/ViewPagerActivity.kt | 2 +- .../simplemobiletools/gallery/adapters/MyPagerAdapter.kt | 6 +++--- .../com/simplemobiletools/gallery/helpers/Constants.kt | 1 + 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 1b1040443..990ae5c9c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -506,7 +506,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { openFile(Uri.fromFile(file), false) } else { Intent(this, ViewPagerActivity::class.java).apply { - putExtra(MEDIUM, path) + putExtra(PATH, path) putExtra(SHOW_ALL, mShowAll) startActivity(this) } 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 0d9e054dc..9867df395 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -23,6 +23,7 @@ import com.simplemobiletools.gallery.fragments.ViewPagerFragment import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY import com.simplemobiletools.gallery.helpers.IS_VIEW_INTENT import com.simplemobiletools.gallery.helpers.MEDIUM +import com.simplemobiletools.gallery.helpers.PATH import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File @@ -108,7 +109,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList Intent(this, ViewPagerActivity::class.java).apply { putExtra(IS_VIEW_INTENT, true) putExtra(IS_FROM_GALLERY, mIsFromGallery) - putExtra(MEDIUM, path) + putExtra(PATH, 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 a99a66b4d..57946761e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -101,7 +101,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } else { try { - mPath = intent.getStringExtra(MEDIUM) + mPath = intent.getStringExtra(PATH) mShowAll = config.showAll } catch (e: Exception) { showErrorToast(e) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt index b7e5640ad..b4be25e37 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt @@ -23,10 +23,10 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m bundle.putSerializable(MEDIUM, medium) val fragment: ViewPagerFragment - if (medium.video) { - fragment = VideoFragment() + fragment = if (medium.video) { + VideoFragment() } else { - fragment = PhotoFragment() + PhotoFragment() } fragment.arguments = bundle 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 663cf7706..6e24d3fc4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -59,6 +59,7 @@ val NOMEDIA = ".nomedia" val DIRECTORY = "directory" val MEDIUM = "medium" +val PATH = "path" val GET_IMAGE_INTENT = "get_image_intent" val GET_VIDEO_INTENT = "get_video_intent" val GET_ANY_INTENT = "get_any_intent"