update filename in mediastore at Rename
This commit is contained in:
parent
06e1796902
commit
31f42118bb
1 changed files with 2 additions and 1 deletions
|
@ -79,7 +79,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)
|
||||
values.put(MediaStore.MediaColumns.DISPLAY_NAME, newFile.name)
|
||||
values.put(MediaStore.MediaColumns.TITLE, newFile.name)
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue