Add favorited badge to browse and search (#5440)
(cherry picked from commit 88fd799a3069ac28dd667e84383662a103c0c12a)
This commit is contained in:
parent
fe51ad5d4b
commit
2975acd8db
@ -44,6 +44,12 @@ class SourceComfortableGridHolder(private val view: View, private val adapter: F
|
|||||||
// Set alpha of thumbnail.
|
// Set alpha of thumbnail.
|
||||||
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
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)
|
setImage(manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.ui.browse.source.browse
|
package eu.kanade.tachiyomi.ui.browse.source.browse
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import coil.clear
|
import coil.clear
|
||||||
import coil.imageLoader
|
import coil.imageLoader
|
||||||
import coil.request.CachePolicy
|
import coil.request.CachePolicy
|
||||||
@ -48,6 +49,12 @@ class SourceEnhancedEHentaiListHolder(private val view: View, adapter: FlexibleA
|
|||||||
// Set alpha of thumbnail.
|
// Set alpha of thumbnail.
|
||||||
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
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)
|
setImage(manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,12 @@ open class SourceGridHolder(private val view: View, private val adapter: Flexibl
|
|||||||
// Set alpha of thumbnail.
|
// Set alpha of thumbnail.
|
||||||
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
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)
|
setImage(manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,12 @@ class SourceListHolder(private val view: View, adapter: FlexibleAdapter<*>) :
|
|||||||
// Set alpha of thumbnail.
|
// Set alpha of thumbnail.
|
||||||
binding.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f
|
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)
|
setImage(manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.ui.browse.source.globalsearch
|
package eu.kanade.tachiyomi.ui.browse.source.globalsearch
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import coil.clear
|
import coil.clear
|
||||||
import coil.imageLoader
|
import coil.imageLoader
|
||||||
import coil.request.ImageRequest
|
import coil.request.ImageRequest
|
||||||
@ -36,10 +37,18 @@ class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) :
|
|||||||
fun bind(manga: Manga) {
|
fun bind(manga: Manga) {
|
||||||
binding.card.clipToOutline = true
|
binding.card.clipToOutline = true
|
||||||
|
|
||||||
|
// Set manga title
|
||||||
binding.title.text = manga.title
|
binding.title.text = manga.title
|
||||||
|
|
||||||
// Set alpha of thumbnail.
|
// Set alpha of thumbnail.
|
||||||
binding.cover.alpha = if (manga.favorite) 0.3f else 1.0f
|
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)
|
setImage(manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,32 @@
|
|||||||
tools:ignore="ContentDescription"
|
tools:ignore="ContentDescription"
|
||||||
tools:src="@mipmap/ic_launcher" />
|
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>
|
</FrameLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -110,6 +110,22 @@
|
|||||||
tools:text="120"
|
tools:text="120"
|
||||||
tools:visibility="visible" />
|
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>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||||
|
@ -109,6 +109,22 @@
|
|||||||
tools:text="120"
|
tools:text="120"
|
||||||
tools:visibility="visible" />
|
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>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -19,6 +19,31 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/thumbnail"
|
android:id="@+id/thumbnail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -97,6 +97,22 @@
|
|||||||
tools:text="130"
|
tools:text="130"
|
||||||
tools:visibility="visible" />
|
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>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user