use the fast documentfile getting at Renaming too
This commit is contained in:
parent
544258dbce
commit
c0fcb48d9c
1 changed files with 7 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.simplemobiletools.gallery.dialogs
|
package com.simplemobiletools.gallery.dialogs
|
||||||
|
|
||||||
|
import android.provider.DocumentsContract
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
|
@ -57,9 +58,12 @@ class RenameFileDialog(val activity: SimpleActivity, val file: File, val callbac
|
||||||
if (activity.isShowingPermDialog(file))
|
if (activity.isShowingPermDialog(file))
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
|
|
||||||
val document = context.getFileDocument(file.absolutePath, context.config.treeUri)
|
var document = context.getFastDocument(file)
|
||||||
if (document.canWrite())
|
if (!document.isFile) {
|
||||||
document.renameTo(newFile.name)
|
document = context.getFileDocument(file.absolutePath, context.config.treeUri)
|
||||||
|
}
|
||||||
|
|
||||||
|
DocumentsContract.renameDocument(context.contentResolver, document.uri, newFile.name)
|
||||||
sendSuccess(file, newFile)
|
sendSuccess(file, newFile)
|
||||||
dismiss()
|
dismiss()
|
||||||
} else if (file.renameTo(newFile)) {
|
} else if (file.renameTo(newFile)) {
|
||||||
|
|
Loading…
Reference in a new issue