Skip to content

Instantly share code, notes, and snippets.

@lelandrichardson
Created August 27, 2020 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lelandrichardson/e41c3a99e8b9566aaa0853e3c0912ecb to your computer and use it in GitHub Desktop.
Save lelandrichardson/e41c3a99e8b9566aaa0853e3c0912ecb to your computer and use it in GitHub Desktop.
fun updateCount(count: Int) {
if (count > 0 && !hasBadge()) {
addBadge()
} else if (count == 0 && hasBadge()) {
removeBadge()
}
if (count > 99 && !hasFire()) {
addFire()
setBadgeText("99+")
} else if (count <= 99 && hasFire()) {
removeFire()
}
if (count > 0 && !hasPaper()) {
addPaper()
} else if (count == 0 && hasPaper()) {
removePaper()
}
if (count <= 99) {
setBadgeText("$count")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment