mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 13:48:55 +03:00
Add favorited badge to browse and search (#5440)
This commit is contained in:
parent
ef937f277e
commit
88fd799a30
8 changed files with 104 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package eu.kanade.tachiyomi.ui.browse.source.browse
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import coil.clear
|
||||
import coil.imageLoader
|
||||
import coil.request.ImageRequest
|
||||
|
@ -37,6 +38,12 @@ class SourceComfortableGridHolder(private val view: View, private val adapter: F
|
|||
// Set alpha of thumbnail.
|
||||
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
||||
|
||||
// For rounded corners
|
||||
binding.badges.clipToOutline = true
|
||||
|
||||
// Set favorite badge
|
||||
binding.favoriteText.isVisible = manga.favorite
|
||||
|
||||
setImage(manga)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.kanade.tachiyomi.ui.browse.source.browse
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import coil.clear
|
||||
import coil.imageLoader
|
||||
import coil.request.ImageRequest
|
||||
|
@ -37,6 +38,12 @@ open class SourceGridHolder(private val view: View, private val adapter: Flexibl
|
|||
// Set alpha of thumbnail.
|
||||
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
||||
|
||||
// For rounded corners
|
||||
binding.badges.clipToOutline = true
|
||||
|
||||
// Set favorite badge
|
||||
binding.favoriteText.isVisible = manga.favorite
|
||||
|
||||
setImage(manga)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.kanade.tachiyomi.ui.browse.source.browse
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import coil.clear
|
||||
import coil.loadAny
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
|
@ -40,6 +41,12 @@ class SourceListHolder(private val view: View, adapter: FlexibleAdapter<*>) :
|
|||
// Set alpha of thumbnail.
|
||||
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
||||
|
||||
// For rounded corners
|
||||
binding.badges.clipToOutline = true
|
||||
|
||||
// Set favorite badge
|
||||
binding.favoriteText.isVisible = manga.favorite
|
||||
|
||||
setImage(manga)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.kanade.tachiyomi.ui.browse.source.globalsearch
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import coil.clear
|
||||
import coil.imageLoader
|
||||
import coil.request.ImageRequest
|
||||
|
@ -36,10 +37,18 @@ class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) :
|
|||
fun bind(manga: Manga) {
|
||||
binding.card.clipToOutline = true
|
||||
|
||||
// Set manga title
|
||||
binding.title.text = manga.title
|
||||
|
||||
// Set alpha of thumbnail.
|
||||
binding.cover.alpha = if (manga.favorite) 0.3f else 1.0f
|
||||
|
||||
// For rounded corners
|
||||
binding.badges.clipToOutline = true
|
||||
|
||||
// Set favorite badge
|
||||
binding.favoriteText.isVisible = manga.favorite
|
||||
|
||||
setImage(manga)
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,32 @@
|
|||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/badges"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@drawable/rounded_rectangle">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/favorite_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSecondary"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/in_library"
|
||||
android:textColor="?attr/colorOnSecondary"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -84,6 +84,22 @@
|
|||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/favorite_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSecondary"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/in_library"
|
||||
android:textColor="?attr/colorOnSecondary"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
|
|
|
@ -83,6 +83,22 @@
|
|||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/favorite_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSecondary"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/in_library"
|
||||
android:textColor="?attr/colorOnSecondary"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -97,6 +97,22 @@
|
|||
tools:text="130"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/favorite_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSecondary"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/in_library"
|
||||
android:textColor="?attr/colorOnSecondary"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
Loading…
Reference in a new issue