use a badge instead of in library text for list view since it can get cut off (#868)

This commit is contained in:
Carlos 2021-06-22 22:35:04 -04:00 committed by GitHub
parent 6194423d17
commit 97c4f6979b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View File

@ -34,11 +34,8 @@ class BrowseSourceListHolder(private val view: View, adapter: FlexibleAdapter<IF
*/ */
override fun onSetValues(manga: Manga) { override fun onSetValues(manga: Manga) {
binding.title.text = manga.title binding.title.text = manga.title
with(binding.subtitle) { binding.inLibraryBadge.inLibraryBadge.visibility = if (manga.favorite) View.VISIBLE else View.GONE
visibility = if (manga.favorite) View.VISIBLE else View.GONE
text = view.resources.getString(R.string.in_library)
setTextColor(view.context.getResourceColor(android.R.attr.colorAccent))
}
setImage(manga) setImage(manga)
} }

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/badge"
android:layout_width="10dp"
android:layout_height="10dp"
app:cardCornerRadius="10dp"
app:cardElevation="4dp"
app:cardBackgroundColor="?attr/colorAccent"
android:visibility="gone"
tools:visibility="visible"/>

View File

@ -8,6 +8,16 @@
android:id="@+id/constraint_layout" android:id="@+id/constraint_layout"
android:background="@drawable/list_item_selector"> android:background="@drawable/list_item_selector">
<include
layout="@layout/in_library_badge"
android:id="@+id/in_library_badge"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="2dp"
android:layout_marginStart="2dp"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/card" android:id="@+id/card"
android:layout_width="wrap_content" android:layout_width="wrap_content"