animate directory removal too

This commit is contained in:
tibbi 2016-12-08 22:53:04 +01:00
parent ca62b62bec
commit 0926c60dd3
2 changed files with 11 additions and 3 deletions

View File

@ -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)

View File

@ -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)
}