From c8e178f270956e609f9b42abb08b57e267daa734 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Feb 2019 09:38:27 +0100 Subject: [PATCH] handle OTG permissions dialog the same way as SD card permission --- app/build.gradle | 2 +- .../simplemobiletools/gallery/pro/activities/MainActivity.kt | 2 +- .../gallery/pro/activities/ViewPagerActivity.kt | 3 ++- .../com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a18e1440f..d6f62a617 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.7.17' + implementation 'com.simplemobiletools:commons:5.7.22' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 32493cdc1..aa515a200 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -376,7 +376,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { if (hasOTGConnected()) { runOnUiThread { ConfirmationDialog(this, getString(R.string.usb_detected), positive = R.string.ok, negative = 0) { - handleOTGPermission { + handleSAFDialog(config.OTGPath) { if (config.OTGPartition.isNotEmpty()) { config.addIncludedFolder(config.OTGPath) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index f2341cdc8..0ff1faf6f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -584,11 +584,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun saveImageAs() { val currPath = getCurrentPath() SaveAsDialog(this, currPath, false) { + val newPath = it handleSAFDialog(it) { toast(R.string.saving) Thread { val photoFragment = getCurrentPhotoFragment() ?: return@Thread - saveRotatedImageToFile(currPath, it, photoFragment.mCurrentRotationDegrees, true) { + saveRotatedImageToFile(currPath, newPath, photoFragment.mCurrentRotationDegrees, true) { toast(R.string.file_saved) getCurrentPhotoFragment()?.mCurrentRotationDegrees = 0 invalidateOptionsMenu() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 7d839b8dd..1d01a9a25 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -373,7 +373,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList(selectedKeys.size) val removeMedia = ArrayList(selectedKeys.size)