refresh cached directly at contentobserver triggering too

This commit is contained in:
tibbi 2019-05-26 10:29:57 +02:00
parent 1445434930
commit f20ef872ca

View file

@ -6,11 +6,13 @@ import android.net.Uri
import android.provider.MediaStore import android.provider.MediaStore
import android.view.WindowManager import android.view.WindowManager
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.getParentPath
import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.getRealPathFromURI
import com.simplemobiletools.commons.helpers.isPiePlus import com.simplemobiletools.commons.helpers.isPiePlus
import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.extensions.addPathToDB import com.simplemobiletools.gallery.pro.extensions.addPathToDB
import com.simplemobiletools.gallery.pro.extensions.config import com.simplemobiletools.gallery.pro.extensions.config
import com.simplemobiletools.gallery.pro.extensions.updateDirectoryPath
open class SimpleActivity : BaseSimpleActivity() { open class SimpleActivity : BaseSimpleActivity() {
val observer = object : ContentObserver(null) { val observer = object : ContentObserver(null) {
@ -18,6 +20,7 @@ open class SimpleActivity : BaseSimpleActivity() {
super.onChange(selfChange, uri) super.onChange(selfChange, uri)
val path = getRealPathFromURI(uri) val path = getRealPathFromURI(uri)
if (path != null) { if (path != null) {
updateDirectoryPath(path.getParentPath())
addPathToDB(path) addPathToDB(path)
} }
} }