mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 10:07:38 +00:00
Fixed messages on modules screen replicating indefinitely
This commit is contained in:
parent
7bf7bfb9c6
commit
9c4c310f46
@ -155,24 +155,12 @@ class ModuleViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
itemsInstalled.addOnListChangedCallback(
|
itemsInstalled.addOnListChangedCallback(
|
||||||
onItemRangeInserted = { _, _, _ ->
|
onItemRangeInserted = { _, _, _ -> itemsInstalledHelpers.clear() },
|
||||||
itemsInstalledHelpers.clear()
|
onItemRangeRemoved = { _, _, _ -> addInstalledEmptyMessage() }
|
||||||
},
|
|
||||||
onItemRangeRemoved = { sender, _, _ ->
|
|
||||||
if (sender.isEmpty() && itemsInstalledHelpers.isEmpty()) {
|
|
||||||
itemsInstalledHelpers.add(itemNoneInstalled)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
itemsUpdatable.addOnListChangedCallback(
|
itemsUpdatable.addOnListChangedCallback(
|
||||||
onItemRangeInserted = { _, _, _ ->
|
onItemRangeInserted = { _, _, _ -> itemsUpdatableHelpers.clear() },
|
||||||
itemsUpdatableHelpers.clear()
|
onItemRangeRemoved = { _, _, _ -> addUpdatableEmptyMessage() }
|
||||||
},
|
|
||||||
onItemRangeRemoved = { sender, _, _ ->
|
|
||||||
if (sender.isEmpty() && itemsUpdatableHelpers.isEmpty()) {
|
|
||||||
itemsUpdatableHelpers.add(itemNoneUpdatable)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,8 +189,8 @@ class ModuleViewModel(
|
|||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.doOnSuccess { itemsUpdatable.update(it.first, it.second) }
|
.doOnSuccess { itemsUpdatable.update(it.first, it.second) }
|
||||||
.doOnSuccess {
|
.doOnSuccess {
|
||||||
if (itemsInstalled.isEmpty()) itemsInstalledHelpers.add(itemNoneInstalled)
|
addInstalledEmptyMessage()
|
||||||
if (itemsUpdatable.isEmpty()) itemsUpdatableHelpers.add(itemNoneUpdatable)
|
addUpdatableEmptyMessage()
|
||||||
}
|
}
|
||||||
.ignoreElement()!!
|
.ignoreElement()!!
|
||||||
|
|
||||||
@ -287,6 +275,20 @@ class ModuleViewModel(
|
|||||||
.subscribeK { it.progress.value = progress }
|
.subscribeK { it.progress.value = progress }
|
||||||
.add()
|
.add()
|
||||||
|
|
||||||
|
// ---
|
||||||
|
|
||||||
|
private fun addInstalledEmptyMessage() {
|
||||||
|
if (itemsInstalled.isEmpty() && itemsInstalledHelpers.isEmpty()) {
|
||||||
|
itemsInstalledHelpers.add(itemNoneInstalled)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addUpdatableEmptyMessage() {
|
||||||
|
if (itemsUpdatable.isEmpty() && itemsUpdatableHelpers.isEmpty()) {
|
||||||
|
itemsUpdatableHelpers.add(itemNoneUpdatable)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateCoreOnlyWarning() {
|
private fun updateCoreOnlyWarning() {
|
||||||
if (Config.coreOnly) {
|
if (Config.coreOnly) {
|
||||||
if (itemsCoreOnly.isNotEmpty()) return
|
if (itemsCoreOnly.isNotEmpty()) return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user