From 2544c918597a09aa497943fd8bc5a6662a03b06f Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 22 Feb 2017 18:32:03 +0100 Subject: [PATCH] update commons to 2.6.8 --- app/build.gradle | 2 +- .../com/simplemobiletools/gallery/activities/EditActivity.kt | 2 +- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 +- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 4 ++-- .../gallery/dialogs/RenameDirectoryDialog.kt | 2 +- .../com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index da6fa4e7e..0545b395c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.6.7' + compile 'com.simplemobiletools:commons:2.6.8' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' 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 a2c2f3379..ac04d6ca1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -128,7 +128,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener if (isShowingPermDialog(file)) return - var document = getFileDocument(path, config.treeUri) + var document = getFileDocument(path, config.treeUri) ?: return if (!file.exists()) { document = document.createFile("", file.name) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 1efbc4b81..8e27069cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -200,7 +200,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { Thread({ if (!file.delete()) { - val document = getFileDocument(file.absolutePath, config.treeUri) + val document = getFileDocument(file.absolutePath, config.treeUri) ?: return@Thread // double check we have the uri to the proper file path, not some parent folder val uri = URLDecoder.decode(document.uri.toString(), "UTF-8") diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index d8f0b9e9b..7f167836b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -238,7 +238,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { if (it.delete() || tryFastDocumentDelete(it)) { hadSuccess = true } else { - val document = getFileDocument(it.absolutePath, config.treeUri) + val document = getFileDocument(it.absolutePath, config.treeUri) ?: return@forEach if (document.isFile && document.delete()) { hadSuccess = true } 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 34a1abb0b..a4b7c910e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -191,7 +191,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (isShowingPermDialog(file)) return@SaveAsDialog - var document = getFileDocument(it, config.treeUri) + var document = getFileDocument(it, config.treeUri) ?: return@SaveAsDialog if (!file.exists()) { document = document.createFile("", file.name) } @@ -320,7 +320,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View Thread { if (!file.delete() && !tryFastDocumentDelete(file)) { - val document = getFileDocument(file.absolutePath, config.treeUri) + val document = getFileDocument(file.absolutePath, config.treeUri) ?: return@Thread if (!document.isFile || !document.delete()) { runOnUiThread { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt index a485974ae..6a6539c24 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt @@ -49,7 +49,7 @@ class RenameDirectoryDialog(val activity: SimpleActivity, val dir: File, val cal if (activity.isShowingPermDialog(dir)) return@setOnClickListener - val document = context.getFileDocument(dir.absolutePath, context.config.treeUri) + val document = context.getFileDocument(dir.absolutePath, context.config.treeUri) ?: return@setOnClickListener if (document.canWrite()) document.renameTo(newDirName) sendSuccess(updatedFiles, newDir) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt index 63e1ac632..bd1c62caf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt @@ -59,11 +59,11 @@ class RenameFileDialog(val activity: SimpleActivity, val file: File, val callbac return@setOnClickListener var document = context.getFastDocument(file) - if (!document.isFile) { + if (document?.isFile == false) { document = context.getFileDocument(file.absolutePath, context.config.treeUri) } - DocumentsContract.renameDocument(context.contentResolver, document.uri, newFile.name) + DocumentsContract.renameDocument(context.contentResolver, document!!.uri, newFile.name) sendSuccess(file, newFile) dismiss() } else if (file.renameTo(newFile)) {