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 b093cad22..65b25669f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt @@ -4,9 +4,9 @@ import android.app.AlertDialog import android.view.LayoutInflater import android.view.WindowManager import com.simplemobiletools.filepicker.extensions.* -import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity +import com.simplemobiletools.gallery.helpers.Config import kotlinx.android.synthetic.main.rename_directory.view.* import java.io.File import java.util.* 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 d197771bb..862f7a76d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt @@ -80,8 +80,8 @@ class RenameFileDialog(val activity: SimpleActivity, val file: File, val callbac private fun sendSuccess(oldFile: File, newFile: File) { val values = ContentValues() values.put(MediaStore.MediaColumns.DATA, newFile.absolutePath) - val updated = activity.contentResolver.update(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values, - "${MediaStore.MediaColumns.DATA} = '${oldFile.absolutePath}'", null) == 1 + val uri = if (oldFile.isImageSlow()) MediaStore.Images.Media.EXTERNAL_CONTENT_URI else MediaStore.Video.Media.EXTERNAL_CONTENT_URI + val updated = activity.contentResolver.update(uri, values, "${MediaStore.MediaColumns.DATA} = '${oldFile.absolutePath}'", null) == 1 if (updated) { callback.invoke(newFile)