New manga info expander (#5771)
* Replace "More" with Arrows
We used to have arrows but it was set away from the description which took a lot of space.
It was changed to "More" text, but with the recent design changes I think it'd look better to get a mix between them both.
* Properly align icons
Co-Authored-By: Andreas <6576096+ghostbear@users.noreply.github.com>
* Expand support to Tablets
Get it... expand... hehe 😎
* Fix expanded width
Also fixes so that the constraint for the toggleLess is dependant on the right thing
* Give info toggles its own space
Uses its own margin now to push info rather than just being attached as a info margin.
* Remove weird duplicates I did not add
I did not add these but I don't see a reason to keep dupes
* Add bottom scrim
* Change to centered arrow under info
Anyone wanna experiment/build on top off then feel free to tweak
* Add background glow to icon for contrast
Co-Authored-By: Andreas <6576096+ghostbear@users.noreply.github.com>
Co-authored-by: Andreas <6576096+ghostbear@users.noreply.github.com>
Co-authored-by: Andreas <andreas.everos@gmail.com>
(cherry picked from commit 57aefcd917)
# Conflicts:
# app/src/main/res/drawable/manga_info_more_gradient.xml
# app/src/main/res/layout/manga_info_header.xml
# app/src/main/res/xml/manga_summary_section_scene.xml
This commit is contained in:
@@ -68,6 +68,8 @@ class MangaInfoHeaderAdapter(
|
||||
|
||||
private var initialLoad: Boolean = true
|
||||
|
||||
private val maxLines = 3
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HeaderViewHolder {
|
||||
binding = MangaInfoHeaderBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
updateCoverPosition()
|
||||
@@ -381,7 +383,10 @@ class MangaInfoHeaderAdapter(
|
||||
binding.mangaSummaryText.text = if (manga.description.isNullOrBlank()) {
|
||||
view.context.getString(R.string.unknown)
|
||||
} else {
|
||||
manga.description
|
||||
// Max lines of 3 with a blank line looks whack so we remove
|
||||
// any line breaks that is 2 or more and replace it with 1
|
||||
manga.description!!
|
||||
.replace(Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)), "\n")
|
||||
}
|
||||
|
||||
// SY -->
|
||||
@@ -443,7 +448,7 @@ class MangaInfoHeaderAdapter(
|
||||
}
|
||||
|
||||
// Refreshes will change the state and it needs to be set to correct state to display correctly
|
||||
if (binding.mangaSummaryText.maxLines == 2) {
|
||||
if (binding.mangaSummaryText.maxLines == maxLines) {
|
||||
binding.mangaSummarySection.transitionToState(R.id.start)
|
||||
} else {
|
||||
binding.mangaSummarySection.transitionToState(R.id.end)
|
||||
@@ -456,7 +461,7 @@ class MangaInfoHeaderAdapter(
|
||||
}
|
||||
|
||||
private fun toggleMangaInfo() {
|
||||
val isCurrentlyExpanded = binding.mangaSummaryText.maxLines != 2
|
||||
val isCurrentlyExpanded = binding.mangaSummaryText.maxLines != maxLines
|
||||
|
||||
if (isCurrentlyExpanded) {
|
||||
binding.mangaSummarySection.transitionToStart()
|
||||
@@ -465,7 +470,7 @@ class MangaInfoHeaderAdapter(
|
||||
}
|
||||
|
||||
binding.mangaSummaryText.maxLines = if (isCurrentlyExpanded) {
|
||||
2
|
||||
maxLines
|
||||
} else {
|
||||
Int.MAX_VALUE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user