mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix addSelected and cancel bugs
This commit is contained in:
parent
c5d2b30bc8
commit
7804da72b3
2 changed files with 7 additions and 4 deletions
|
@ -200,6 +200,10 @@ class DownloadFragment : Fragment() {
|
|||
context?.let { ctx -> downloadsViewModel.handleMultiDelete(ctx) }
|
||||
}
|
||||
binding?.downloadDeleteToolbar?.btnCancel?.setOnClickListener {
|
||||
adapter?.setDeleteCheckboxVisibility(false)
|
||||
adapter?.clearSelectedIds()
|
||||
adapter?.notifyItemRangeChanged(0, adapter.itemCount)
|
||||
|
||||
downloadsViewModel.clearSelectedIds()
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,9 @@ class DownloadViewModel : ViewModel() {
|
|||
private var previousVisual: List<VisualDownloadHeaderCached>? = null
|
||||
|
||||
fun addSelected(id: Int, name: String) {
|
||||
selectedIds.value?.let { selectedIds ->
|
||||
selectedIds[id] = name
|
||||
_selectedIds.postValue(selectedIds)
|
||||
}
|
||||
val currentSelected = selectedIds.value ?: HashMap()
|
||||
currentSelected[id] = name
|
||||
_selectedIds.postValue(currentSelected)
|
||||
}
|
||||
|
||||
fun setSelected(selected: HashMap<Int, String>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue