mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 12:49:02 +00:00
fix owned count in shops. Fixes #874
This commit is contained in:
parent
ca9ef4efc5
commit
3e39633313
2 changed files with 6 additions and 6 deletions
|
|
@ -120,16 +120,16 @@ public class RealmInventoryLocalRepository extends RealmContentLocalRepository i
|
|||
(Func4<RealmResults<? extends Item>, RealmResults<? extends Item>, RealmResults<? extends Item>, RealmResults<? extends Item>, Map<String, Item>>) (eggs, hatchingPotions, food, quests) -> {
|
||||
Map<String, Item> items = new HashMap<>();
|
||||
for (Item item : eggs) {
|
||||
items.put(item.getKey(), item);
|
||||
items.put(item.getKey()+"-"+item.getType(), item);
|
||||
}
|
||||
for (Item item : hatchingPotions) {
|
||||
items.put(item.getKey(), item);
|
||||
items.put(item.getKey()+"-"+item.getType(), item);
|
||||
}
|
||||
for (Item item : food) {
|
||||
items.put(item.getKey(), item);
|
||||
items.put(item.getKey()+"-"+item.getType(), item);
|
||||
}
|
||||
for (Item item : quests) {
|
||||
items.put(item.getKey(), item);
|
||||
items.put(item.getKey()+"-"+item.getType(), item);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ class ShopRecyclerAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
|||
ShopItem::class.java -> {
|
||||
val item = obj as ShopItem
|
||||
(holder as ShopItemViewHolder).bind(item, item.canAfford(user))
|
||||
if (ownedItems.containsKey(item.key)) {
|
||||
holder.itemCount = ownedItems[item.key]?.owned ?: 0
|
||||
if (ownedItems.containsKey(item.key+"-"+item.pinType)) {
|
||||
holder.itemCount = ownedItems[item.key+"-"+item.pinType]?.owned ?: 0
|
||||
}
|
||||
holder.isPinned = pinnedItemKeys.contains(item.key)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue