use real_file_path at photoVideoActivity better

This commit is contained in:
tibbi 2018-02-20 16:05:50 +01:00
parent b70292652b
commit 66993d784e
3 changed files with 9 additions and 6 deletions

View file

@ -65,7 +65,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
saveUri = when { saveUri = when {
intent.extras?.containsKey(REAL_FILE_PATH) == true -> { 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)) { if (realPath.startsWith(OTG_PATH)) {
Uri.parse(realPath) Uri.parse(realPath)
} else { } else {

View file

@ -11,7 +11,6 @@ import android.view.View
import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.PropertiesDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY 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.PERMISSION_WRITE_STORAGE
import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.commons.helpers.REAL_FILE_PATH
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
@ -60,10 +59,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
private fun checkIntent(savedInstanceState: Bundle? = null) { private fun checkIntent(savedInstanceState: Bundle? = null) {
mUri = intent.data ?: return mUri = intent.data ?: return
if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { if (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)) { sendViewPagerIntent(realPath)
mUri = Uri.fromFile(File(realPath)) finish()
} return
} }
mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false)

View file

@ -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()) { if (mPath.isEmpty()) {
toast(R.string.unknown_error_occurred) toast(R.string.unknown_error_occurred)
finish() finish()