Droppers / AnimatedBottomBar

A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.
MIT License
1.38k stars 109 forks source link

What is the role of the setEnabled() method in the Badge Class? #57

Open WORLD8848 opened 2 years ago

WORLD8848 commented 2 years ago

What is the role of the setEnabled() method in the Badge Class?

` override fun setEnabled(enabled: Boolean) { val lastEnabled = isEnabled super.setEnabled(enabled)

    if (lastEnabled == enabled) {
        return
    }

    if (animationType == AnimatedBottomBar.BadgeAnimation.NONE) {
        visibility = if (enabled) VISIBLE else GONE
        return
    }

    animator.run {
        duration = _animationDuration.toLong()

        if(isEnabled) {
            start()
        } else {
            reverse()
        }
    }
}`