More minSdk 21 cleanup
This commit is contained in:
parent
4ec9cbe379
commit
189c92affa
4 changed files with 5 additions and 26 deletions
|
|
@ -12,7 +12,6 @@ import android.view.View
|
|||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.FloatRange
|
||||
import androidx.core.animation.addListener
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
|
|
@ -21,10 +20,6 @@ import org.schabi.newpipe.MainActivity
|
|||
|
||||
private const val TAG = "ViewUtils"
|
||||
|
||||
inline var View.backgroundTintListCompat: ColorStateList?
|
||||
get() = ViewCompat.getBackgroundTintList(this)
|
||||
set(value) = ViewCompat.setBackgroundTintList(this, value)
|
||||
|
||||
/**
|
||||
* Animate the view.
|
||||
*
|
||||
|
|
@ -106,11 +101,11 @@ fun View.animateBackgroundColor(duration: Long, @ColorInt colorStart: Int, @Colo
|
|||
viewPropertyAnimator.interpolator = FastOutSlowInInterpolator()
|
||||
viewPropertyAnimator.duration = duration
|
||||
viewPropertyAnimator.addUpdateListener { animation: ValueAnimator ->
|
||||
backgroundTintListCompat = ColorStateList(empty, intArrayOf(animation.animatedValue as Int))
|
||||
backgroundTintList = ColorStateList(empty, intArrayOf(animation.animatedValue as Int))
|
||||
}
|
||||
viewPropertyAnimator.addListener(
|
||||
onCancel = { backgroundTintListCompat = ColorStateList(empty, intArrayOf(colorEnd)) },
|
||||
onEnd = { backgroundTintListCompat = ColorStateList(empty, intArrayOf(colorEnd)) }
|
||||
onCancel = { backgroundTintList = ColorStateList(empty, intArrayOf(colorEnd)) },
|
||||
onEnd = { backgroundTintList = ColorStateList(empty, intArrayOf(colorEnd)) }
|
||||
)
|
||||
viewPropertyAnimator.start()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue