refresh directories instantly after un/pinning
This commit is contained in:
parent
5c7dfb87be
commit
0ef9ff06bf
|
@ -552,6 +552,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
directories_grid.setDragSelectActive(position)
|
||||
}
|
||||
|
||||
override fun recheckPinnedFolders() {
|
||||
gotDirectories(movePinnedDirectoriesToFront(mDirs), true)
|
||||
}
|
||||
|
||||
private fun checkWhatsNewDialog() {
|
||||
arrayListOf<Release>().apply {
|
||||
add(Release(46, R.string.release_46))
|
||||
|
|
|
@ -221,7 +221,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
|||
config.removePinnedFolders(getSelectedPaths())
|
||||
|
||||
pinnedFolders = config.pinnedFolders
|
||||
listener?.refreshItems()
|
||||
listener?.recheckPinnedFolders()
|
||||
notifyDataSetChanged()
|
||||
actMode?.finish()
|
||||
}
|
||||
|
@ -462,5 +462,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
|||
fun tryDeleteFolders(folders: ArrayList<File>)
|
||||
|
||||
fun itemLongClicked(position: Int)
|
||||
|
||||
fun recheckPinnedFolders()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,11 @@ fun Context.movePinnedDirectoriesToFront(dirs: ArrayList<Directory>): ArrayList<
|
|||
val foundFolders = ArrayList<Directory>()
|
||||
val pinnedFolders = config.pinnedFolders
|
||||
|
||||
dirs.forEach { if (pinnedFolders.contains(it.path)) foundFolders.add(it) }
|
||||
dirs.forEach {
|
||||
if (pinnedFolders.contains(it.path))
|
||||
foundFolders.add(it)
|
||||
}
|
||||
|
||||
dirs.removeAll(foundFolders)
|
||||
dirs.addAll(0, foundFolders)
|
||||
return dirs
|
||||
|
|
Loading…
Reference in New Issue