From 12e90ae35e37dd9d155a65d03a071f9d56e8f716 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 12 Apr 2021 17:11:47 -0400 Subject: [PATCH] Use same non-sticky heading style as Browse for Updates/History (closes #4822) --- .../browse/extension/ExtensionGroupHolder.kt | 4 ++-- .../ui/browse/extension/ExtensionGroupItem.kt | 2 +- .../migration/sources/SelectionHeader.kt | 6 +++--- .../tachiyomi/ui/browse/source/LangHolder.kt | 4 ++-- .../tachiyomi/ui/browse/source/LangItem.kt | 2 +- .../tachiyomi/ui/recent/DateSectionItem.kt | 8 +++---- .../ui/recent/history/HistoryAdapter.kt | 1 - .../ui/recent/updates/UpdatesAdapter.kt | 1 - .../main/res/layout/extension_controller.xml | 2 +- .../main/res/layout/recent_section_item.xml | 21 ------------------- ...ard_header.xml => section_header_item.xml} | 0 .../res/layout/source_main_controller.xml | 2 +- 12 files changed, 15 insertions(+), 38 deletions(-) delete mode 100644 app/src/main/res/layout/recent_section_item.xml rename app/src/main/res/layout/{source_main_controller_card_header.xml => section_header_item.xml} (100%) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionGroupHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionGroupHolder.kt index fbe31cf8f..bd56e8279 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionGroupHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionGroupHolder.kt @@ -4,12 +4,12 @@ import android.annotation.SuppressLint import android.view.View import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.viewholders.FlexibleViewHolder -import eu.kanade.tachiyomi.databinding.SourceMainControllerCardHeaderBinding +import eu.kanade.tachiyomi.databinding.SectionHeaderItemBinding class ExtensionGroupHolder(view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter) { - private val binding = SourceMainControllerCardHeaderBinding.bind(view) + private val binding = SectionHeaderItemBinding.bind(view) @SuppressLint("SetTextI18n") fun bind(item: ExtensionGroupItem) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionGroupItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionGroupItem.kt index 6e235f91c..cb0bfa1c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionGroupItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionGroupItem.kt @@ -19,7 +19,7 @@ data class ExtensionGroupItem(val name: String, val size: Int, val showSize: Boo * Returns the layout resource of this item. */ override fun getLayoutRes(): Int { - return R.layout.source_main_controller_card_header + return R.layout.section_header_item } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt index 15b506bd4..e617a7fdb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt @@ -7,7 +7,7 @@ import eu.davidea.flexibleadapter.items.AbstractHeaderItem import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.viewholders.FlexibleViewHolder import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.databinding.SourceMainControllerCardHeaderBinding +import eu.kanade.tachiyomi.databinding.SectionHeaderItemBinding /** * Item that contains the selection header. @@ -18,7 +18,7 @@ class SelectionHeader : AbstractHeaderItem() { * Returns the layout resource of this item. */ override fun getLayoutRes(): Int { - return R.layout.source_main_controller_card_header + return R.layout.section_header_item } /** @@ -45,7 +45,7 @@ class SelectionHeader : AbstractHeaderItem() { class Holder(view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter) { - private val binding = SourceMainControllerCardHeaderBinding.bind(view) + private val binding = SectionHeaderItemBinding.bind(view) init { binding.title.text = view.context.getString(R.string.migration_selection_prompt) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/LangHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/LangHolder.kt index edb50eaee..2a7ce220e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/LangHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/LangHolder.kt @@ -3,13 +3,13 @@ package eu.kanade.tachiyomi.ui.browse.source import android.view.View import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.viewholders.FlexibleViewHolder -import eu.kanade.tachiyomi.databinding.SourceMainControllerCardHeaderBinding +import eu.kanade.tachiyomi.databinding.SectionHeaderItemBinding import eu.kanade.tachiyomi.util.system.LocaleHelper class LangHolder(view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter) { - private val binding = SourceMainControllerCardHeaderBinding.bind(view) + private val binding = SectionHeaderItemBinding.bind(view) fun bind(item: LangItem) { binding.title.text = LocaleHelper.getSourceDisplayName(item.code, itemView.context) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/LangItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/LangItem.kt index 189c1c41d..b94e4b5dd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/LangItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/LangItem.kt @@ -18,7 +18,7 @@ data class LangItem(val code: String) : AbstractHeaderItem() { * Returns the layout resource of this item. */ override fun getLayoutRes(): Int { - return R.layout.source_main_controller_card_header + return R.layout.section_header_item } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/DateSectionItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/DateSectionItem.kt index 1eb7b56fb..438ad285e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/DateSectionItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/DateSectionItem.kt @@ -8,13 +8,13 @@ import eu.davidea.flexibleadapter.items.AbstractHeaderItem import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.viewholders.FlexibleViewHolder import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.databinding.RecentSectionItemBinding +import eu.kanade.tachiyomi.databinding.SectionHeaderItemBinding import java.util.Date class DateSectionItem(val date: Date) : AbstractHeaderItem() { override fun getLayoutRes(): Int { - return R.layout.recent_section_item + return R.layout.section_header_item } override fun createViewHolder(view: View, adapter: FlexibleAdapter>): DateSectionItemHolder { @@ -39,12 +39,12 @@ class DateSectionItem(val date: Date) : AbstractHeaderItem) : FlexibleViewHolder(view, adapter, true) { - private val binding = RecentSectionItemBinding.bind(view) + private val binding = SectionHeaderItemBinding.bind(view) private val now = Date().time fun bind(item: DateSectionItem) { - binding.sectionText.text = DateUtils.getRelativeTimeSpanString(item.date.time, now, DateUtils.DAY_IN_MILLIS) + binding.title.text = DateUtils.getRelativeTimeSpanString(item.date.time, now, DateUtils.DAY_IN_MILLIS) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryAdapter.kt index 4772c6095..3042d7ca7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryAdapter.kt @@ -35,7 +35,6 @@ class HistoryAdapter(controller: HistoryController) : init { setDisplayHeadersAtStartUp(true) - setStickyHeaders(true) } interface OnResumeClickListener { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesAdapter.kt index 764308246..78a5b8e65 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesAdapter.kt @@ -18,7 +18,6 @@ class UpdatesAdapter( init { setDisplayHeadersAtStartUp(true) - setStickyHeaders(true) } interface OnCoverClickListener { diff --git a/app/src/main/res/layout/extension_controller.xml b/app/src/main/res/layout/extension_controller.xml index 0c751f694..c6dd1c376 100644 --- a/app/src/main/res/layout/extension_controller.xml +++ b/app/src/main/res/layout/extension_controller.xml @@ -17,7 +17,7 @@ android:clipToPadding="false" android:paddingTop="8dp" android:paddingBottom="@dimen/action_toolbar_list_padding" - tools:listitem="@layout/source_main_controller_card_header" /> + tools:listitem="@layout/section_header_item" /> diff --git a/app/src/main/res/layout/recent_section_item.xml b/app/src/main/res/layout/recent_section_item.xml deleted file mode 100644 index 4d0d6a19f..000000000 --- a/app/src/main/res/layout/recent_section_item.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - diff --git a/app/src/main/res/layout/source_main_controller_card_header.xml b/app/src/main/res/layout/section_header_item.xml similarity index 100% rename from app/src/main/res/layout/source_main_controller_card_header.xml rename to app/src/main/res/layout/section_header_item.xml diff --git a/app/src/main/res/layout/source_main_controller.xml b/app/src/main/res/layout/source_main_controller.xml index b9706bf4b..fee14a4c9 100644 --- a/app/src/main/res/layout/source_main_controller.xml +++ b/app/src/main/res/layout/source_main_controller.xml @@ -12,7 +12,7 @@ android:clipToPadding="false" android:paddingTop="8dp" android:paddingBottom="@dimen/action_toolbar_list_padding" - tools:listitem="@layout/source_main_controller_card_header" /> + tools:listitem="@layout/section_header_item" />