mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
CHanged the background animation from drawable to directly modification of the window bg
This commit is contained in:
parent
f38d4ac47d
commit
f64512f865
1 changed files with 2 additions and 7 deletions
|
|
@ -7,7 +7,6 @@ import android.animation.ValueAnimator
|
|||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.view.View
|
||||
import eu.ottop.yamlauncher.settings.SharedPreferenceManager
|
||||
|
||||
|
|
@ -41,12 +40,10 @@ class Animations (context: Context) {
|
|||
// Only animate darkness onto the transparent background
|
||||
if (originalColor == Color.parseColor("#00000000")) {
|
||||
val newColor = Color.parseColor("#3F000000")
|
||||
val colorDrawable = ColorDrawable(originalColor)
|
||||
activity.window.setBackgroundDrawable(colorDrawable)
|
||||
|
||||
val backgroundColorAnimator = ValueAnimator.ofObject(ArgbEvaluator(), originalColor, newColor)
|
||||
backgroundColorAnimator.addUpdateListener { animator ->
|
||||
colorDrawable.color = animator.animatedValue as Int
|
||||
activity.window.decorView.setBackgroundColor(animator.animatedValue as Int)
|
||||
}
|
||||
|
||||
val duration = sharedPreferenceManager.getAnimationSpeed()
|
||||
|
|
@ -64,12 +61,10 @@ class Animations (context: Context) {
|
|||
// Only animate darkness onto the transparent background
|
||||
if (newColor == Color.parseColor("#00000000")) {
|
||||
val originalColor = Color.parseColor("#3F000000")
|
||||
val colorDrawable = ColorDrawable(originalColor)
|
||||
activity.window.setBackgroundDrawable(colorDrawable)
|
||||
|
||||
val backgroundColorAnimator = ValueAnimator.ofObject(ArgbEvaluator(), originalColor, newColor)
|
||||
backgroundColorAnimator.addUpdateListener { animator ->
|
||||
colorDrawable.color = animator.animatedValue as Int
|
||||
activity.window.decorView.setBackgroundColor(animator.animatedValue as Int)
|
||||
}
|
||||
|
||||
backgroundColorAnimator.duration = duration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue