mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
parent
d79afb8235
commit
694778515c
1 changed files with 9 additions and 4 deletions
|
@ -71,9 +71,10 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
|
|||
setBackgroundColor(context.getResourceColor(R.attr.colorTertiary))
|
||||
}
|
||||
|
||||
shapeAppearanceModel = shapeAppearanceModel.withCornerSize(radius)
|
||||
if (changeShape) {
|
||||
shapeAppearanceModel = makeShapeCorners(radius, radius)
|
||||
if (binding.downloadText.isVisible) {
|
||||
if (binding.downloadText.isVisible && binding.unreadText.isVisible) {
|
||||
binding.downloadText.background =
|
||||
MaterialShapeDrawable(makeShapeCorners(topStart = radius)).apply {
|
||||
this.fillColor =
|
||||
|
@ -83,7 +84,7 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
|
|||
MaterialShapeDrawable(makeShapeCorners(bottomEnd = radius)).apply {
|
||||
this.fillColor = ColorStateList.valueOf(unreadBadgeBackground)
|
||||
}
|
||||
} else {
|
||||
} else if (binding.unreadText.isVisible) {
|
||||
binding.unreadText.background =
|
||||
MaterialShapeDrawable(makeShapeCorners(radius, radius)).apply {
|
||||
this.fillColor = ColorStateList.valueOf(unreadBadgeBackground)
|
||||
|
@ -91,9 +92,13 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
|
|||
if (unread == -1) {
|
||||
shapeAppearanceModel = shapeAppearanceModel.withCornerSize(radius)
|
||||
}
|
||||
} else if (binding.downloadText.isVisible) {
|
||||
binding.downloadText.background =
|
||||
MaterialShapeDrawable(makeShapeCorners(radius, radius)).apply {
|
||||
this.fillColor =
|
||||
ColorStateList.valueOf(context.getResourceColor(R.attr.colorTertiary))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
shapeAppearanceModel = shapeAppearanceModel.withCornerSize(radius)
|
||||
}
|
||||
|
||||
// Show the badge card if unread or downloads exists
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue