Created
July 10, 2021 01:53
-
-
Save navczydev/df7cde1a43727627ac3954cb0023bc2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add badge to alarm | |
val badgeDrawable = activityMainBinding.navigationRail?.getOrCreateBadge(R.id.alarms) | |
badgeDrawable?.run { | |
Toast.makeText(applicationContext, "Create badge", Toast.LENGTH_SHORT).show() | |
number = 999 | |
badgeTextColor = | |
ContextCompat.getColor(applicationContext, android.R.color.holo_red_light) | |
maxCharacterCount = 2 | |
badgeGravity = BadgeDrawable.TOP_START | |
isVisible = true | |
} | |
// remove badge | |
// activityMainBinding.navigationRail?.removeBadge(R.id.alarms) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment