-
-
Save virendersran01/02f699ddd44bc14d6c0d308be3efdda6 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
class ClickDrawable(layers: Array<out Drawable> = arrayOf()) : LayerDrawable(layers) { | |
… | |
private val mask: Drawable = | |
ColorDrawable(0xFF00FFFF.toInt()).apply { alpha = 0 } | |
init { | |
addLayer(mask) | |
} | |
… | |
@Keep | |
private fun setMaskAlpha(alpha: Int) { | |
mask.alpha = alpha | |
invalidateSelf() | |
} | |
private fun colorMask(fromAlpha: Int, toAlpha: Int) { | |
val anim = ObjectAnimator.ofInt(this, "maskAlpha", fromAlpha, toAlpha, fromAlpha) | |
anim.duration = DURATION | |
anim.interpolator = LinearInterpolator() | |
anim.start() | |
} | |
private fun setClickActive(active: Boolean) { | |
if (mActive != active) { | |
mActive = active | |
if (active && canStart) { | |
… | |
colorMask(0, 64) | |
} | |
} | |
} | |
@Keep | |
private fun setBounds(value: Float) { … } | |
… | |
private companion object { | |
const val DURATION = 225L | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment