Explorar el Código

Show locale in sources list items

arkon hace 4 años
padre
commit
ed41604f56

+ 4 - 1
app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt

@@ -6,11 +6,13 @@ import eu.kanade.tachiyomi.R
 import eu.kanade.tachiyomi.source.LocalSource
 import eu.kanade.tachiyomi.source.icon
 import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
+import eu.kanade.tachiyomi.util.system.LocaleHelper
 import eu.kanade.tachiyomi.util.system.getResourceColor
 import eu.kanade.tachiyomi.util.view.setVectorCompat
 import kotlinx.android.synthetic.main.source_main_controller_card_item.image
 import kotlinx.android.synthetic.main.source_main_controller_card_item.pin
 import kotlinx.android.synthetic.main.source_main_controller_card_item.source_latest
+import kotlinx.android.synthetic.main.source_main_controller_card_item.subtitle
 import kotlinx.android.synthetic.main.source_main_controller_card_item.title
 
 class SourceHolder(private val view: View, val adapter: SourceAdapter) :
@@ -29,8 +31,9 @@ class SourceHolder(private val view: View, val adapter: SourceAdapter) :
     fun bind(item: SourceItem) {
         val source = item.source
 
-        // Set source name
         title.text = source.name
+        subtitle.isVisible = true
+        subtitle.text = LocaleHelper.getDisplayName(source.lang)
 
         // Set source icon
         itemView.post {

+ 17 - 1
app/src/main/res/layout/source_main_controller_card_item.xml

@@ -28,12 +28,28 @@
         android:paddingStart="0dp"
         android:paddingEnd="8dp"
         android:textAppearance="@style/TextAppearance.Regular.SubHeading"
-        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintBottom_toTopOf="@id/subtitle"
         app:layout_constraintEnd_toStartOf="@+id/source_latest"
         app:layout_constraintStart_toEndOf="@+id/image"
         app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintVertical_chainStyle="packed"
         tools:text="Source title" />
 
+    <TextView
+        android:id="@+id/subtitle"
+        style="@style/TextAppearance.Regular.Body1.Secondary"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:maxLines="1"
+        android:textSize="12sp"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toStartOf="@+id/source_latest"
+        app:layout_constraintStart_toEndOf="@id/image"
+        app:layout_constraintTop_toBottomOf="@+id/title"
+        tools:text="English"
+        tools:visibility="visible"/>
+
     <Button
         android:id="@+id/source_latest"
         style="@style/Theme.Widget.Button"