Replace language code in Global Search with secondary text (#3972)

Replace language code in Global Search with secondary text
This commit is contained in:
Andreas E 2020-10-25 20:25:58 +01:00 committed by GitHub
parent 837ce62844
commit 9493577de2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View File

@ -5,9 +5,11 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder 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.no_results_found
import kotlinx.android.synthetic.main.global_search_controller_card.progress 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.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
import kotlinx.android.synthetic.main.global_search_controller_card.title_wrapper 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 results = item.results
val titlePrefix = if (item.highlighted) "" else "" 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
title.text = titlePrefix + source.name + langSuffix subtitle.isVisible = true
subtitle.text = LocaleHelper.getDisplayName(source.lang)
when { when {
results == null -> { results == null -> {

View File

@ -17,13 +17,30 @@
style="@style/TextAppearance.Regular.SubHeading" style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label" android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toTopOf="@+id/subtitle"
app:layout_constraintEnd_toStartOf="@+id/title_more_icon" app:layout_constraintEnd_toStartOf="@+id/title_more_icon"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Title" /> tools:text="Title" />
<TextView
android:id="@+id/subtitle"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:textSize="12sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/title_more_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title"
tools:text="English"
tools:visibility="visible" />
<ImageView <ImageView
android:id="@+id/title_more_icon" android:id="@+id/title_more_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"