pull/1630/head
kunfei 3 years ago
parent 88e9de47a5
commit 0dfbc43f92
  1. 11
      app/src/main/java/io/legado/app/ui/widget/text/BadgeView.kt

@ -16,7 +16,7 @@ import androidx.appcompat.widget.AppCompatTextView
import io.legado.app.R import io.legado.app.R
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
import io.legado.app.utils.getCompatColor import io.legado.app.utils.getCompatColor
import io.legado.app.utils.gone import io.legado.app.utils.invisible
import io.legado.app.utils.visible import io.legado.app.utils.visible
@ -129,7 +129,7 @@ class BadgeView @JvmOverloads constructor(
*/ */
override fun setText(text: CharSequence, type: BufferType) { override fun setText(text: CharSequence, type: BufferType) {
if (isHideOnNull && TextUtils.isEmpty(text)) { if (isHideOnNull && TextUtils.isEmpty(text)) {
gone() invisible()
} else { } else {
visible() visible()
} }
@ -137,12 +137,7 @@ class BadgeView @JvmOverloads constructor(
} }
fun setBadgeCount(count: Int) { fun setBadgeCount(count: Int) {
text = count.toString() text = if (count == 0) "" else count.toString()
if (count == 0) {
gone()
} else {
visible()
}
} }
fun setHighlight(highlight: Boolean) { fun setHighlight(highlight: Boolean) {

Loading…
Cancel
Save