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))
|
setBackgroundColor(context.getResourceColor(R.attr.colorTertiary))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shapeAppearanceModel = shapeAppearanceModel.withCornerSize(radius)
|
||||||
if (changeShape) {
|
if (changeShape) {
|
||||||
shapeAppearanceModel = makeShapeCorners(radius, radius)
|
shapeAppearanceModel = makeShapeCorners(radius, radius)
|
||||||
if (binding.downloadText.isVisible) {
|
if (binding.downloadText.isVisible && binding.unreadText.isVisible) {
|
||||||
binding.downloadText.background =
|
binding.downloadText.background =
|
||||||
MaterialShapeDrawable(makeShapeCorners(topStart = radius)).apply {
|
MaterialShapeDrawable(makeShapeCorners(topStart = radius)).apply {
|
||||||
this.fillColor =
|
this.fillColor =
|
||||||
|
@ -83,7 +84,7 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||||
MaterialShapeDrawable(makeShapeCorners(bottomEnd = radius)).apply {
|
MaterialShapeDrawable(makeShapeCorners(bottomEnd = radius)).apply {
|
||||||
this.fillColor = ColorStateList.valueOf(unreadBadgeBackground)
|
this.fillColor = ColorStateList.valueOf(unreadBadgeBackground)
|
||||||
}
|
}
|
||||||
} else {
|
} else if (binding.unreadText.isVisible) {
|
||||||
binding.unreadText.background =
|
binding.unreadText.background =
|
||||||
MaterialShapeDrawable(makeShapeCorners(radius, radius)).apply {
|
MaterialShapeDrawable(makeShapeCorners(radius, radius)).apply {
|
||||||
this.fillColor = ColorStateList.valueOf(unreadBadgeBackground)
|
this.fillColor = ColorStateList.valueOf(unreadBadgeBackground)
|
||||||
|
@ -91,9 +92,13 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||||
if (unread == -1) {
|
if (unread == -1) {
|
||||||
shapeAppearanceModel = shapeAppearanceModel.withCornerSize(radius)
|
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
|
// Show the badge card if unread or downloads exists
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue