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 4b8c448c6..54de2bfd5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -65,7 +65,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener saveUri = when { intent.extras?.containsKey(REAL_FILE_PATH) == true -> { - val realPath = intent.extras.get(REAL_FILE_PATH) as String + val realPath = intent.extras.getString(REAL_FILE_PATH) if (realPath.startsWith(OTG_PATH)) { Uri.parse(realPath) } else { 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 beb01858a..f3c4084bd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -11,7 +11,6 @@ import android.view.View import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY -import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.R @@ -60,10 +59,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun checkIntent(savedInstanceState: Bundle? = null) { mUri = intent.data ?: return if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { - val realPath = intent.extras.get(REAL_FILE_PATH) as String - if (!realPath.startsWith(OTG_PATH)) { - mUri = Uri.fromFile(File(realPath)) - } + val realPath = intent.extras.getString(REAL_FILE_PATH) + sendViewPagerIntent(realPath) + finish() + return } mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) 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 e0cc68a17..7fff7e8c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -172,6 +172,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } + if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { + mPath = intent.extras.getString(REAL_FILE_PATH) + } + if (mPath.isEmpty()) { toast(R.string.unknown_error_occurred) finish()