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