Merge pull request #1902 from Hafizzle/Fiz/mystery_item_fixes

Mystery Item Sprite fixes
This commit is contained in:
Phillip Thelen 2023-01-11 10:42:38 +01:00 committed by GitHub
commit 062303de1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -181,6 +181,10 @@ class ItemRecyclerAdapter(val context: Context) : BaseRecyclerViewAdapter<OwnedI
if ((ownedItem?.numberOwned ?: 0) > 0) {
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.use_item)))
}
} else if (ownedItem?.itemType == "special") {
if ((ownedItem?.numberOwned ?: 0) > 0) {
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.use_item)))
}
}
menu.setSelectionRunnable { index ->
item?.let { selectedItem ->

View file

@ -160,12 +160,12 @@ class ItemRecyclerFragment : BaseFragment<FragmentItemsBinding>(), SwipeRefreshL
val dialog = OpenedMysteryitemDialog(activity)
dialog.isCelebratory = true
dialog.setTitle(R.string.mystery_item_title)
dialog.binding.iconView.loadImage("shop_${it.key}")
dialog.binding.iconView.loadImage("shop_${item.key}")
dialog.binding.titleView.text = item.text
dialog.binding.descriptionView.text = item.notes
dialog.addButton(R.string.equip, true) { _, _ ->
lifecycleScope.launchCatching {
inventoryRepository.equip("equipped", it.key)
item.key?.let { mysteryItem -> inventoryRepository.equip("equipped", mysteryItem) }
}
}
dialog.addCloseButton()