update renamed videos properly too
This commit is contained in:
parent
4a2d8076d0
commit
1ae4e0cc02
|
@ -4,9 +4,9 @@ import android.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import com.simplemobiletools.filepicker.extensions.*
|
import com.simplemobiletools.filepicker.extensions.*
|
||||||
import com.simplemobiletools.gallery.helpers.Config
|
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
import com.simplemobiletools.gallery.activities.SimpleActivity
|
import com.simplemobiletools.gallery.activities.SimpleActivity
|
||||||
|
import com.simplemobiletools.gallery.helpers.Config
|
||||||
import kotlinx.android.synthetic.main.rename_directory.view.*
|
import kotlinx.android.synthetic.main.rename_directory.view.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
|
@ -80,8 +80,8 @@ class RenameFileDialog(val activity: SimpleActivity, val file: File, val callbac
|
||||||
private fun sendSuccess(oldFile: File, newFile: File) {
|
private fun sendSuccess(oldFile: File, newFile: File) {
|
||||||
val values = ContentValues()
|
val values = ContentValues()
|
||||||
values.put(MediaStore.MediaColumns.DATA, newFile.absolutePath)
|
values.put(MediaStore.MediaColumns.DATA, newFile.absolutePath)
|
||||||
val updated = activity.contentResolver.update(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values,
|
val uri = if (oldFile.isImageSlow()) MediaStore.Images.Media.EXTERNAL_CONTENT_URI else MediaStore.Video.Media.EXTERNAL_CONTENT_URI
|
||||||
"${MediaStore.MediaColumns.DATA} = '${oldFile.absolutePath}'", null) == 1
|
val updated = activity.contentResolver.update(uri, values, "${MediaStore.MediaColumns.DATA} = '${oldFile.absolutePath}'", null) == 1
|
||||||
|
|
||||||
if (updated) {
|
if (updated) {
|
||||||
callback.invoke(newFile)
|
callback.invoke(newFile)
|
||||||
|
|
Loading…
Reference in New Issue