call scanPath and scanFile on contexts only to avoid leaks

This commit is contained in:
tibbi 2018-01-23 18:40:29 +01:00
parent 5c3af88a4e
commit 96010b4c8e
5 changed files with 8 additions and 8 deletions

View file

@ -228,7 +228,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
}
private fun scanFinalPath(path: String) {
scanPath(path) {
applicationContext.scanPath(path) {
setResult(Activity.RESULT_OK, intent)
toast(R.string.file_saved)
finish()

View file

@ -55,7 +55,7 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
config.addIncludedFolder(it)
updateFolders()
Thread {
scanPath(it)
applicationContext.scanPath(it)
}.start()
}
}

View file

@ -64,14 +64,14 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false)
if (mUri!!.scheme == "file") {
scanPath(mUri!!.path)
applicationContext.scanPath(mUri!!.path)
sendViewPagerIntent(mUri!!.path)
finish()
return
} else {
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms") {
scanPath(mUri!!.path)
applicationContext.scanPath(mUri!!.path)
sendViewPagerIntent(path)
finish()
return

View file

@ -205,7 +205,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
reloadViewPager()
scanPath(mPath)
applicationContext.scanPath(mPath)
if (config.blackBackground) {
view_pager.background = ColorDrawable(Color.BLACK)
@ -530,7 +530,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
deleteFile(newFile)
}
copyFile(tmpFile, newFile)
scanFile(newFile)
applicationContext.scanFile(newFile)
toast(R.string.file_saved)
if (config.keepLastModified) {
@ -799,7 +799,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
deleteFile(file, true)
}
scanPath(mDirectory)
applicationContext.scanPath(mDirectory)
}
private fun checkOrientation() {

View file

@ -116,7 +116,7 @@ fun BaseSimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
}
}
scanFile(file) {
applicationContext.scanFile(file) {
callback()
}
}