Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reuse of icons #95

Merged
merged 1 commit into from
Feb 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ abstract class StashPresenter : Presenter() {
LayoutInflater.from(infoView.context)
.inflate(R.layout.image_card_extra, infoView, true) as ViewGroup

iconMap.forEach {
setUpIcon(sceneExtra, it.key, it.value)
}
if (oCounter != null && oCounter > 0) {
setUpIcon(sceneExtra, null, oCounter)
DataType.entries.forEach {
val count = iconMap[it] ?: -1
setUpIcon(sceneExtra, it, count)
}
setUpIcon(sceneExtra, null, oCounter ?: -1)
}

private fun setUpIcon(
Expand Down Expand Up @@ -140,7 +139,7 @@ abstract class StashPresenter : Presenter() {
iconResId = R.id.extra_ocounter_icon
}

else -> throw IllegalArgumentException()
else -> return
}
val textView = rootView.findViewById<TextView>(textResId)
val iconView = rootView.findViewById<View>(iconResId)
Expand All @@ -149,6 +148,10 @@ abstract class StashPresenter : Presenter() {
textView.visibility = View.VISIBLE
iconView.visibility = View.VISIBLE
(textView.parent as ViewGroup).visibility = View.VISIBLE
} else {
textView.visibility = View.GONE
iconView.visibility = View.GONE
(textView.parent as ViewGroup).visibility = View.GONE
}
}

Expand Down
Loading