do not add the OTG folder at included ones

This commit is contained in:
tibbi 2019-02-16 13:59:32 +01:00
parent c8e178f270
commit 9ab9d5b8fa
3 changed files with 5 additions and 17 deletions

View file

@ -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'

View file

@ -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()

View file

@ -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"