Start updating manga info view header design (SY edition)

(cherry picked from commit 791a7d5a01)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt
#	app/src/main/res/layout/manga_info_header.xml
This commit is contained in:
arkon
2020-09-07 17:18:41 -04:00
committed by Jobobby04
parent 07973bff32
commit 4e8c30b7fe
12 changed files with 172 additions and 179 deletions
@@ -432,6 +432,7 @@ class MangaController :
if (preferences.recommendsInOverflow().get()) menu.findItem(R.id.action_recommend).isVisible = true
menu.findItem(R.id.action_merged).isVisible = presenter.manga.source == MERGED_SOURCE_ID
menu.findItem(R.id.action_toggle_dedupe).isVisible = false // presenter.manga.source == MERGED_SOURCE_ID
menu.findItem(R.id.action_merge).isVisible = presenter.manga.favorite
// SY <--
}
@@ -465,6 +466,9 @@ class MangaController :
presenter.dedupe = !presenter.dedupe
presenter.toggleDedupe()
}
R.id.action_merge -> {
openSmartSearch()
}
// SY <--
R.id.action_edit_categories -> onCategoriesClick()
@@ -66,7 +66,7 @@ class MangaChaptersHeaderAdapter(
} else {
view.context.getResourceColor(R.attr.colorOnPrimary)
}
DrawableCompat.setTint(binding.btnChaptersFilter.icon, filterColor)
DrawableCompat.setTint(binding.btnChaptersFilter.drawable, filterColor)
merge(view.clicks(), binding.btnChaptersFilter.clicks())
.onEach { controller.showSettingsSheet() }
@@ -115,13 +115,27 @@ class MangaInfoHeaderAdapter(
isVisible = true
if (trackCount > 0) {
setIconResource(R.drawable.ic_done_24dp)
text = view.context.resources.getQuantityString(R.plurals.num_trackers, trackCount, trackCount)
isChecked = true
setCompoundDrawablesWithIntrinsicBounds(
null,
ContextCompat.getDrawable(context, R.drawable.ic_done_24dp),
null,
null
)
text = view.context.resources.getQuantityString(
R.plurals.num_trackers,
trackCount,
trackCount
)
isSelected = true
} else {
setIconResource(R.drawable.ic_sync_24dp)
setCompoundDrawablesWithIntrinsicBounds(
null,
ContextCompat.getDrawable(context, R.drawable.ic_sync_24dp),
null,
null
)
text = view.context.getString(R.string.manga_tracking_tab)
isChecked = false
isSelected = false
}
clicks()
@@ -147,12 +161,6 @@ class MangaInfoHeaderAdapter(
.onEach { controller.migrateManga() }
.launchIn(scope)
binding.btnMigrate.setTooltip(R.string.migrate)
binding.btnSmartSearch.isVisible = true
binding.btnSmartSearch.clicks()
.onEach { controller.openSmartSearch() }
.launchIn(scope)
binding.btnSmartSearch.setTooltip(R.string.merge_with_another_source)
}
// SY <--
@@ -314,13 +322,18 @@ class MangaInfoHeaderAdapter(
// Set the Favorite drawable to the correct one.
// Border drawable if false, filled drawable if true.
binding.btnFavorite.apply {
icon = ContextCompat.getDrawable(
context,
if (isFavorite) R.drawable.ic_favorite_24dp else R.drawable.ic_favorite_border_24dp
setCompoundDrawablesWithIntrinsicBounds(
null,
ContextCompat.getDrawable(
context,
if (isFavorite) R.drawable.ic_favorite_24dp else R.drawable.ic_favorite_border_24dp
),
null,
null
)
text =
context.getString(if (isFavorite) R.string.in_library else R.string.add_to_library)
isChecked = isFavorite
isSelected = isFavorite
}
}
}
@@ -114,7 +114,6 @@ class MangaInfoItemAdapter(
if (binding.mangaSummaryText.text == "meta") {
binding.mangaSummaryText.isVisible = false
binding.mangaSummaryLabel.setText(R.string.tags)
}
// Update genres list
@@ -164,20 +163,22 @@ class MangaInfoItemAdapter(
private fun toggleMangaInfo(context: Context) {
val isExpanded =
binding.mangaInfoToggle.text == context.getString(R.string.manga_info_collapse)
binding.mangaInfoToggle.contentDescription == context.getString(R.string.manga_info_collapse)
with(binding.mangaInfoToggle) {
text = if (isExpanded) {
contentDescription = if (isExpanded) {
context.getString(R.string.manga_info_expand)
} else {
context.getString(R.string.manga_info_collapse)
}
icon = if (isExpanded) {
context.getDrawable(R.drawable.ic_baseline_expand_more_24dp)
} else {
context.getDrawable(R.drawable.ic_baseline_expand_less_24dp)
}
setImageDrawable(
if (isExpanded) {
context.getDrawable(R.drawable.ic_baseline_expand_more_24dp)
} else {
context.getDrawable(R.drawable.ic_baseline_expand_less_24dp)
}
)
}
with(binding.mangaSummaryText) {