diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt index 01a510955..b6ecd4d35 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt @@ -148,9 +148,12 @@ fun BaseSimpleActivity.toggleFileVisibility(oldPath: String, hide: Boolean, call filename.substring(1, filename.length) } - val newPath = "$path$filename" + val newPath = "$path/$filename" renameFile(oldPath, newPath) { callback?.invoke(newPath) + Thread { + updateMediaPath(oldPath, newPath) + }.start() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/MediumDao.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/MediumDao.kt index cd2cb1564..da7612e52 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/MediumDao.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/MediumDao.kt @@ -23,6 +23,6 @@ interface MediumDao { @Query("DELETE FROM media WHERE full_path = :path") fun deleteMediumPath(path: String) - @Query("UPDATE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath") + @Query("UPDATE OR REPLACE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath") fun updateMedia(oldPath: String, newParentPath: String, newFilename: String, newFullPath: String) }