Fix adding items of the same name on frontend

This commit is contained in:
Reimar 2025-05-08 11:52:41 +02:00
parent 2a4b0c671d
commit 1b4f9059f4
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268

View File

@ -148,6 +148,16 @@ class ShoppingListFragment : Fragment() {
activity?.runOnUiThread {
val adapter = binding.shoppingList.adapter as ShoppingItemAdapter
for (i in 0 ..< adapter.count) {
if (adapter.getItem(i)?.id == item.id) {
adapter.remove(adapter.getItem(i))
adapter.insert(item, i)
return@runOnUiThread
}
}
adapter.insert(item, adapter.count)
}
}