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 BlurViewModel : ViewModel() { | |
... | |
internal fun applyBlur(blurLevel: Int) { | |
val chargingConstraints = Constraints.Builder() | |
.setRequiresCharging(true) | |
.build() | |
val cleanupRequest = OneTimeWorkRequest |
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
fun animateVisibility(view: View, visible: Boolean) { | |
val targetAlpha = if (visible) 1f else 0f | |
if (view.alpha == targetAlpha) return | |
view.visibility = View.VISIBLE | |
val spring = view.spring(SpringAnimation.ALPHA) | |
(view.getTag(R.id.tag_pending_end_listener) as? DynamicAnimation.OnAnimationEndListener)?.let { | |
spring.removeEndListener(it) | |
} | |
OlderNewer