diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoItemAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoItemAdapter.kt index 8d151cb30..6bc3c846f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoItemAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoItemAdapter.kt @@ -1,7 +1,5 @@ package eu.kanade.tachiyomi.ui.manga.info -import android.content.Context -import android.text.TextUtils import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -141,17 +139,26 @@ class MangaInfoItemAdapter( binding.mangaGenresTagsCompactChips.setChipsExtended(manga.getGenres(), controller::performSearch, controller::performGlobalSearch, source?.id ?: 0) // SY <-- } else { - binding.mangaGenresTagsWrapper.isVisible = false + binding.mangaGenresTagsCompactChips.isVisible = false + binding.mangaGenresTagsFullChips.isVisible = false + // SY --> + binding.genreGroups.isVisible = false + // SY <-- } // Handle showing more or less info - merge(binding.mangaSummarySection.clicks(), binding.mangaSummaryText.clicks(), binding.mangaInfoToggle.clicks()) - .onEach { toggleMangaInfo(view.context) } + merge( + binding.mangaSummarySection.clicks(), + binding.mangaSummaryText.clicks(), + binding.mangaInfoToggleMore.clicks(), + binding.mangaInfoToggleLess.clicks() + ) + .onEach { toggleMangaInfo() } .launchIn(scope) // Expand manga info if navigated from source listing if (initialLoad && fromSource) { - toggleMangaInfo(view.context) + toggleMangaInfo() initialLoad = false } } @@ -161,48 +168,25 @@ class MangaInfoItemAdapter( binding.mangaSummarySection.isVisible = visible } - private fun toggleMangaInfo(context: Context) { - val isExpanded = - binding.mangaInfoToggle.contentDescription == context.getString(R.string.manga_info_collapse) + private fun toggleMangaInfo() { + val isCurrentlyExpanded = binding.mangaSummaryText.maxLines != 2 - with(binding.mangaInfoToggle) { - contentDescription = if (isExpanded) { - context.getString(R.string.manga_info_expand) - } else { - context.getString(R.string.manga_info_collapse) - } + binding.mangaInfoToggleMoreScrim.isVisible = isCurrentlyExpanded + binding.mangaInfoToggleMore.isVisible = isCurrentlyExpanded + binding.mangaInfoToggleLess.isVisible = !isCurrentlyExpanded - setImageDrawable( - if (isExpanded) { - context.getDrawable(R.drawable.ic_baseline_expand_more_24dp) - } else { - context.getDrawable(R.drawable.ic_baseline_expand_less_24dp) - } - ) + binding.mangaSummaryText.maxLines = if (isCurrentlyExpanded) { + 2 + } else { + Int.MAX_VALUE } - with(binding.mangaSummaryText) { - maxLines = - if (isExpanded) { - 2 - } else { - Int.MAX_VALUE - } - - ellipsize = - if (isExpanded) { - TextUtils.TruncateAt.END - } else { - null - } - } - - binding.mangaGenresTagsCompact.isVisible = isExpanded + binding.mangaGenresTagsCompact.isVisible = isCurrentlyExpanded // SY --> if (!source.isNamespaceSource()) { - binding.mangaGenresTagsFullChips.isVisible = !isExpanded + binding.mangaGenresTagsFullChips.isVisible = !isCurrentlyExpanded } else { - binding.genreGroups.isVisible = !isExpanded + binding.genreGroups.isVisible = !isCurrentlyExpanded } // SY <-- } diff --git a/app/src/main/res/drawable/manga_info_more_gradient.xml b/app/src/main/res/drawable/manga_info_more_gradient.xml new file mode 100644 index 000000000..f3a077d04 --- /dev/null +++ b/app/src/main/res/drawable/manga_info_more_gradient.xml @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/app/src/main/res/layout/manga_info_header.xml b/app/src/main/res/layout/manga_info_header.xml index 7c8c82a30..2786c047b 100644 --- a/app/src/main/res/layout/manga_info_header.xml +++ b/app/src/main/res/layout/manga_info_header.xml @@ -38,7 +38,7 @@ android:paddingStart="16dp" android:paddingTop="64dp" android:paddingEnd="16dp" - android:paddingBottom="16dp" + android:paddingBottom="8dp" app:layout_constraintTop_toTopOf="parent"> - - - - - - - + android:background="?attr/selectableItemBackground"> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="Collapsed summary content Collapsed summary content Collapsed summary content Collapsed summary content Collapsed summary content Collapsed summary content" /> - + + + + + + + android:layout_height="wrap_content" + android:requiresFadingEdge="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/manga_summary_text"> + app:chipSpacingHorizontal="4dp" + app:singleLine="true" /> - + - + - - - + tools:listitem="@layout/manga_info_genre_grouping" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/manga_info_toggle_less"/> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index c6304f088..ebd309fd7 100755 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -269,6 +269,23 @@ @color/outlined_button_bg + +