From 9ab9d5b8fae092dc1c8822cc7845caad73d9652a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Feb 2019 13:59:32 +0100 Subject: [PATCH] do not add the OTG folder at included ones --- app/build.gradle | 2 +- .../gallery/pro/activities/MainActivity.kt | 18 +++--------------- .../gallery/pro/helpers/Constants.kt | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d6f62a617..f495e39d7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.7.22' + implementation 'com.simplemobiletools:commons:5.8.0' 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 aa515a200..b814ed2b0 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 @@ -17,7 +17,6 @@ import android.widget.Toast import androidx.appcompat.widget.SearchView import androidx.core.view.MenuItemCompat import androidx.recyclerview.widget.RecyclerView -import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.* @@ -371,18 +370,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } } - private fun checkOTGInclusion() { + private fun checkOTGPath() { Thread { - if (hasOTGConnected()) { - runOnUiThread { - ConfirmationDialog(this, getString(R.string.usb_detected), positive = R.string.ok, negative = 0) { - handleSAFDialog(config.OTGPath) { - if (config.OTGPartition.isNotEmpty()) { - config.addIncludedFolder(config.OTGPath) - } - } - } - } + if (!config.wasOTGHandled && hasPermission(PERMISSION_WRITE_STORAGE) && hasOTGConnected() && config.OTGPath.isEmpty()) { config.wasOTGHandled = true getStorageDirectories().firstOrNull { it.trimEnd('/') != internalStoragePath && it.trimEnd('/') != sdCardPath }?.apply { config.OTGPath = trimEnd('/') @@ -394,9 +384,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private fun tryLoadGallery() { handlePermission(PERMISSION_WRITE_STORAGE) { if (it) { - if (!config.wasOTGHandled && hasPermission(PERMISSION_WRITE_STORAGE)) { - checkOTGInclusion() - } + checkOTGPath() if (config.showAll) { showAllMedia() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 6a6591701..21bcd12d1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -51,7 +51,7 @@ const val ALLOW_INSTANT_CHANGE = "allow_instant_change" const val DO_EXTRA_CHECK = "do_extra_check" const val WAS_NEW_APP_SHOWN = "was_new_app_shown_clock" const val LAST_FILEPICKER_PATH = "last_filepicker_path" -const val WAS_OTG_HANDLED = "was_otg_handled" +const val WAS_OTG_HANDLED = "was_otg_handled_2" const val TEMP_SKIP_DELETE_CONFIRMATION = "temp_skip_delete_confirmation" const val BOTTOM_ACTIONS = "bottom_actions" const val LAST_VIDEO_PATH = "last_video_path"