fix #971, keep items as Favorites at move

This commit is contained in:
tibbi 2018-10-02 21:33:01 +02:00
parent f9000830f5
commit bb7a911df1
3 changed files with 11 additions and 0 deletions

View File

@ -527,6 +527,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
config.tempFolderPath = "" config.tempFolderPath = ""
if (!isCopyOperation) { if (!isCopyOperation) {
refreshViewPager() refreshViewPager()
updateFavoritePaths(fileDirItems, it)
} }
} }
} }

View File

@ -283,6 +283,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
activity.applicationContext.rescanFolderMedia(fileDirItems.first().getParentPath()) activity.applicationContext.rescanFolderMedia(fileDirItems.first().getParentPath())
if (!isCopyOperation) { if (!isCopyOperation) {
listener?.refreshItems() listener?.refreshItems()
activity.updateFavoritePaths(fileDirItems, it)
} }
} }
} }

View File

@ -278,3 +278,12 @@ fun BaseSimpleActivity.showRecycleBinEmptyingDialog(callback: () -> Unit) {
callback() callback()
} }
} }
fun BaseSimpleActivity.updateFavoritePaths(fileDirItems: ArrayList<FileDirItem>, destination: String) {
Thread {
fileDirItems.forEach {
val newPath = "$destination/${it.name}"
updateDBMediaPath(it.path, newPath)
}
}.start()
}