From 85a1eb75c95c1b0c1577a6ddeb6d0ee1a55a9201 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sat, 5 Jun 2021 00:51:43 +0200 Subject: [PATCH] Make cover bigger on tablet UI (#5296) * Make cover bigger on tablet UI Also fix bug when opening from source * Use ISO A5 ratio on tablet UI * Change design * Fix bug that happened when refreshing --- .../ui/manga/info/MangaInfoHeaderAdapter.kt | 23 +- .../res/layout-w720dp/manga_info_header.xml | 282 ++++++++++++++++++ app/src/main/res/layout/manga_info_header.xml | 175 +++++------ .../main/res/values-sw600dp-port/dimens.xml | 4 + app/src/main/res/values/dimens.xml | 2 + .../main/res/xml/manga_info_header_scene.xml | 106 +------ .../xml/manga_info_header_scene_sw600dp.xml | 59 ++++ .../res/xml/manga_summary_section_scene.xml | 142 +++++++++ 8 files changed, 605 insertions(+), 188 deletions(-) create mode 100644 app/src/main/res/layout-w720dp/manga_info_header.xml create mode 100644 app/src/main/res/values-sw600dp-port/dimens.xml create mode 100644 app/src/main/res/xml/manga_info_header_scene_sw600dp.xml create mode 100644 app/src/main/res/xml/manga_summary_section_scene.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt index 454a1d3cb..5523906c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt @@ -243,7 +243,7 @@ class MangaInfoHeaderAdapter( setFavoriteButtonState(manga.favorite) // Set cover if changed. - listOf(binding.mangaCover, binding.backdrop).forEach { + listOfNotNull(binding.mangaCover, binding.backdrop).forEach { it.loadAny(manga) } @@ -277,7 +277,8 @@ class MangaInfoHeaderAdapter( merge( binding.mangaSummaryText.clicks(), binding.mangaInfoToggleMore.clicks(), - binding.mangaInfoToggleLess.clicks() + binding.mangaInfoToggleLess.clicks(), + binding.mangaSummarySection.clicks() ) .onEach { toggleMangaInfo() } .launchIn(controller.viewScope) @@ -288,6 +289,13 @@ class MangaInfoHeaderAdapter( toggleMangaInfo() initialLoad = false } + + // Refreshes will change the state and it needs to be set to correct state to display correctly + if (binding.mangaSummaryText.maxLines == 2) { + binding.mangaSummarySection.transitionToState(R.id.start) + } else { + binding.mangaSummarySection.transitionToState(R.id.end) + } } } @@ -298,18 +306,17 @@ class MangaInfoHeaderAdapter( private fun toggleMangaInfo() { val isCurrentlyExpanded = binding.mangaSummaryText.maxLines != 2 - binding.mangaInfoToggleMoreScrim.isVisible = isCurrentlyExpanded - binding.mangaInfoToggleMore.isVisible = isCurrentlyExpanded - binding.mangaInfoToggleLess.isVisible = !isCurrentlyExpanded + if (isCurrentlyExpanded) { + binding.mangaSummarySection.transitionToStart() + } else { + binding.mangaSummarySection.transitionToEnd() + } binding.mangaSummaryText.maxLines = if (isCurrentlyExpanded) { 2 } else { Int.MAX_VALUE } - - binding.mangaGenresTagsCompact.isVisible = isCurrentlyExpanded - binding.mangaGenresTagsFullChips.isVisible = !isCurrentlyExpanded } /** diff --git a/app/src/main/res/layout-w720dp/manga_info_header.xml b/app/src/main/res/layout-w720dp/manga_info_header.xml new file mode 100644 index 000000000..299529ef1 --- /dev/null +++ b/app/src/main/res/layout-w720dp/manga_info_header.xml @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/manga_info_header.xml b/app/src/main/res/layout/manga_info_header.xml index 69f85920c..e2b80ec53 100644 --- a/app/src/main/res/layout/manga_info_header.xml +++ b/app/src/main/res/layout/manga_info_header.xml @@ -168,100 +168,107 @@ app:layout_constraintTop_toTopOf="@+id/btn_favorite" tools:visibility="visible" /> - - - - - - - - - + app:layout_constraintTop_toBottomOf="@+id/btn_favorite"> - + + + + + + + + + + + + + + + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/manga_info_toggle_less" + tools:visibility="gone" /> - - - - - + diff --git a/app/src/main/res/values-sw600dp-port/dimens.xml b/app/src/main/res/values-sw600dp-port/dimens.xml new file mode 100644 index 000000000..5fb171c81 --- /dev/null +++ b/app/src/main/res/values-sw600dp-port/dimens.xml @@ -0,0 +1,4 @@ + + + 80dp + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index dabe27907..fc0c8c13a 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -14,4 +14,6 @@ 72dp 16dp + + 128dp diff --git a/app/src/main/res/xml/manga_info_header_scene.xml b/app/src/main/res/xml/manga_info_header_scene.xml index de2df81be..047bed8ef 100644 --- a/app/src/main/res/xml/manga_info_header_scene.xml +++ b/app/src/main/res/xml/manga_info_header_scene.xml @@ -6,62 +6,15 @@ motion:constraintSetEnd="@+id/end" motion:constraintSetStart="@id/start" motion:duration="@android:integer/config_mediumAnimTime"> - - - + - - - - - + @@ -134,19 +94,10 @@ motion:layout_constraintEnd_toEndOf="parent" motion:layout_constraintStart_toStartOf="parent" motion:layout_constraintTop_toBottomOf="@id/manga_cover" /> - - - - - diff --git a/app/src/main/res/xml/manga_info_header_scene_sw600dp.xml b/app/src/main/res/xml/manga_info_header_scene_sw600dp.xml new file mode 100644 index 000000000..f05cd8c4e --- /dev/null +++ b/app/src/main/res/xml/manga_info_header_scene_sw600dp.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/manga_summary_section_scene.xml b/app/src/main/res/xml/manga_summary_section_scene.xml new file mode 100644 index 000000000..49ddc4381 --- /dev/null +++ b/app/src/main/res/xml/manga_summary_section_scene.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +