update commons to 2.6.8

This commit is contained in:
tibbi 2017-02-22 18:32:03 +01:00
parent f0021bf6d8
commit 2544c91859
7 changed files with 9 additions and 9 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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