From 9493577de27c40ce8b2b6122cc447d025e34c477 Mon Sep 17 00:00:00 2001 From: Andreas E Date: Sun, 25 Oct 2020 20:25:58 +0100 Subject: [PATCH] Replace language code in Global Search with secondary text (#3972) Replace language code in Global Search with secondary text --- .../source/globalsearch/GlobalSearchHolder.kt | 8 ++++--- .../layout/global_search_controller_card.xml | 21 +++++++++++++++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchHolder.kt index 38b9d8de6..518986def 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchHolder.kt @@ -5,9 +5,11 @@ import androidx.core.view.isVisible import androidx.recyclerview.widget.LinearLayoutManager import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder +import eu.kanade.tachiyomi.util.system.LocaleHelper import kotlinx.android.synthetic.main.global_search_controller_card.no_results_found import kotlinx.android.synthetic.main.global_search_controller_card.progress import kotlinx.android.synthetic.main.global_search_controller_card.recycler +import kotlinx.android.synthetic.main.global_search_controller_card.subtitle import kotlinx.android.synthetic.main.global_search_controller_card.title import kotlinx.android.synthetic.main.global_search_controller_card.title_wrapper @@ -49,10 +51,10 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) : val results = item.results val titlePrefix = if (item.highlighted) "▶ " else "" - val langSuffix = if (source.lang.isNotEmpty()) " (${source.lang})" else "" - // Set Title with country code if available. - title.text = titlePrefix + source.name + langSuffix + title.text = titlePrefix + source.name + subtitle.isVisible = true + subtitle.text = LocaleHelper.getDisplayName(source.lang) when { results == null -> { diff --git a/app/src/main/res/layout/global_search_controller_card.xml b/app/src/main/res/layout/global_search_controller_card.xml index 654099e80..1e887546f 100644 --- a/app/src/main/res/layout/global_search_controller_card.xml +++ b/app/src/main/res/layout/global_search_controller_card.xml @@ -17,13 +17,30 @@ style="@style/TextAppearance.Regular.SubHeading" android:layout_width="0dp" android:layout_height="wrap_content" - android:padding="@dimen/material_component_text_fields_padding_above_and_below_label" - app:layout_constraintBottom_toBottomOf="parent" + android:layout_marginStart="16dp" + app:layout_constraintBottom_toTopOf="@+id/subtitle" app:layout_constraintEnd_toStartOf="@+id/title_more_icon" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_chainStyle="packed" tools:text="Title" /> + +