animate directory removal too
This commit is contained in:
parent
ca62b62bec
commit
0926c60dd3
2 changed files with 11 additions and 3 deletions
|
@ -172,8 +172,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}
|
||||
|
||||
private fun notifyDeletion(cnt: Int) {
|
||||
getDirectories()
|
||||
|
||||
val res = resources
|
||||
val msg = res.getQuantityString(R.plurals.folders_deleted, cnt, cnt)
|
||||
mSnackbar = Snackbar.make(coordinator_layout, msg, Snackbar.LENGTH_INDEFINITE)
|
||||
|
|
|
@ -242,7 +242,17 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
private fun prepareForDeleting() {
|
||||
val selections = multiSelector.selectedPositions
|
||||
val paths = ArrayList<String>(selections.size)
|
||||
selections.forEach { paths.add(dirs[it].path) }
|
||||
val removeDirs = ArrayList<Directory>(selections.size)
|
||||
|
||||
selections.reverse()
|
||||
selections.forEach {
|
||||
val directory = dirs[it]
|
||||
paths.add(directory.path)
|
||||
removeDirs.add(directory)
|
||||
notifyItemRemoved(it)
|
||||
}
|
||||
|
||||
dirs.removeAll(removeDirs)
|
||||
listener?.prepareForDeleting(paths)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue