From 1ae4e0cc02a285242efb65a1fc322cc421a80094 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 7 Dec 2016 19:37:39 +0100 Subject: [PATCH] update renamed videos properly too --- .../gallery/dialogs/RenameDirectoryDialog.kt | 2 +- .../com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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)