From db519701bc41f1949d3a1468e26393dbb902760f Mon Sep 17 00:00:00 2001 From: Koitharu Date: Wed, 8 May 2024 14:29:55 +0300 Subject: [PATCH] Show single branch in details --- .../org/koitharu/kotatsu/details/ui/DetailsActivity.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt index 26bd98f8b..426def2fb 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt @@ -181,7 +181,8 @@ class DetailsActivity : viewModel.isStatsAvailable.observe(this, menuInvalidator) viewModel.remoteManga.observe(this, menuInvalidator) viewModel.branches.observe(this) { - viewBinding.infoLayout.chipBranch.isVisible = it.size > 1 + viewBinding.infoLayout.chipBranch.isVisible = it.size > 1 || it.firstOrNull() != null + viewBinding.infoLayout.chipBranch.isCloseIconVisible = it.size > 1 } viewModel.chapters.observe(this, PrefetchObserver(this)) viewModel.onDownloadStarted @@ -540,8 +541,11 @@ class DetailsActivity : } private fun showBranchPopupMenu(v: View) { - val menu = PopupMenu(v.context, v) val branches = viewModel.branches.value + if (branches.size <= 1) { + return + } + val menu = PopupMenu(v.context, v) for ((i, branch) in branches.withIndex()) { val title = buildSpannedString { if (branch.isCurrent) {