mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-02-09 00:28:58 +01:00
update mediastore after deleted files manually
This commit is contained in:
parent
1ae4e0cc02
commit
62d11861ca
@ -1,6 +1,7 @@
|
|||||||
package com.simplemobiletools.gallery.activities
|
package com.simplemobiletools.gallery.activities
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
|
import android.content.ContentValues
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
@ -219,10 +220,19 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val values = ContentValues()
|
||||||
|
values.put(MediaStore.MediaColumns.DATA, file.absolutePath)
|
||||||
|
val uri = if (file.isImageSlow()) MediaStore.Images.Media.EXTERNAL_CONTENT_URI else MediaStore.Video.Media.EXTERNAL_CONTENT_URI
|
||||||
|
val updated = contentResolver.delete(uri, "${MediaStore.MediaColumns.DATA} = '${file.absolutePath}'", null) == 1
|
||||||
|
|
||||||
|
if (updated) {
|
||||||
|
reloadViewPager()
|
||||||
|
} else {
|
||||||
scanFile(file) {
|
scanFile(file) {
|
||||||
reloadViewPager()
|
reloadViewPager()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isDirEmpty(): Boolean {
|
private fun isDirEmpty(): Boolean {
|
||||||
return if (mMedia.size <= 0) {
|
return if (mMedia.size <= 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user