|
@@ -77,7 +77,7 @@ class AnimationUtil private constructor() {
|
|
* @param view
|
|
* @param view
|
|
*/
|
|
*/
|
|
fun showViewFromBottomToTop(view: View?, duration: Long = 300) {
|
|
fun showViewFromBottomToTop(view: View?, duration: Long = 300) {
|
|
- if (showBottomToTop != null && showBottomToTop!!.isRunning) {
|
|
|
|
|
|
+ if (showBottomToTop?.isRunning == true) {
|
|
if (showBottomToTop?.target == view) {
|
|
if (showBottomToTop?.target == view) {
|
|
showBottomToTop?.cancel()
|
|
showBottomToTop?.cancel()
|
|
showBottomToTop = null
|
|
showBottomToTop = null
|
|
@@ -114,7 +114,7 @@ class AnimationUtil private constructor() {
|
|
* @param view
|
|
* @param view
|
|
*/
|
|
*/
|
|
fun hideViewFromTopToBottom(view: View?, duration: Long = 300) {
|
|
fun hideViewFromTopToBottom(view: View?, duration: Long = 300) {
|
|
- if (showBottomToTop != null && showBottomToTop!!.isRunning) {
|
|
|
|
|
|
+ if (showBottomToTop?.isRunning == true) {
|
|
if (showBottomToTop?.target == view) {
|
|
if (showBottomToTop?.target == view) {
|
|
showBottomToTop?.cancel()
|
|
showBottomToTop?.cancel()
|
|
showBottomToTop = null
|
|
showBottomToTop = null
|
|
@@ -127,7 +127,6 @@ class AnimationUtil private constructor() {
|
|
val pvhA = PropertyValuesHolder.ofFloat("alpha", view.alpha, 0f)
|
|
val pvhA = PropertyValuesHolder.ofFloat("alpha", view.alpha, 0f)
|
|
val pvhY = PropertyValuesHolder.ofFloat("Y", Math.min(view.y, view.top.toFloat()), view.top.toFloat() + view.height)
|
|
val pvhY = PropertyValuesHolder.ofFloat("Y", Math.min(view.y, view.top.toFloat()), view.top.toFloat() + view.height)
|
|
showBottomToTop = ObjectAnimator.ofPropertyValuesHolder(view, pvhA, pvhY)
|
|
showBottomToTop = ObjectAnimator.ofPropertyValuesHolder(view, pvhA, pvhY)
|
|
- showBottomToTop = ObjectAnimator.ofPropertyValuesHolder(view, pvhA, pvhY)
|
|
|
|
showBottomToTop?.apply {
|
|
showBottomToTop?.apply {
|
|
interpolator = AccelerateInterpolator()
|
|
interpolator = AccelerateInterpolator()
|
|
addListener(object : AnimatorListenerAdapter() {
|
|
addListener(object : AnimatorListenerAdapter() {
|
|
@@ -147,7 +146,7 @@ class AnimationUtil private constructor() {
|
|
}
|
|
}
|
|
|
|
|
|
fun showViewFromRightToLeft(view: View?, duration: Long = 300) {
|
|
fun showViewFromRightToLeft(view: View?, duration: Long = 300) {
|
|
- if (showRightToLeft != null && showRightToLeft!!.isRunning) {
|
|
|
|
|
|
+ if (showRightToLeft?.isRunning == true) {
|
|
if (showRightToLeft?.target == view) {
|
|
if (showRightToLeft?.target == view) {
|
|
showRightToLeft?.cancel()
|
|
showRightToLeft?.cancel()
|
|
showRightToLeft = null
|
|
showRightToLeft = null
|
|
@@ -179,7 +178,7 @@ class AnimationUtil private constructor() {
|
|
}
|
|
}
|
|
|
|
|
|
fun hideViewFromLeftToRight(view: View?, duration: Long = 300) {
|
|
fun hideViewFromLeftToRight(view: View?, duration: Long = 300) {
|
|
- if (showRightToLeft != null && showRightToLeft!!.isRunning) {
|
|
|
|
|
|
+ if (showRightToLeft?.isRunning == true) {
|
|
if (showRightToLeft?.target == view) {
|
|
if (showRightToLeft?.target == view) {
|
|
showRightToLeft?.cancel()
|
|
showRightToLeft?.cancel()
|
|
showRightToLeft = null
|
|
showRightToLeft = null
|
|
@@ -216,7 +215,7 @@ class AnimationUtil private constructor() {
|
|
* @param view
|
|
* @param view
|
|
*/
|
|
*/
|
|
fun showViewFromTopToBottom(view: View?, duration: Long = 300) {
|
|
fun showViewFromTopToBottom(view: View?, duration: Long = 300) {
|
|
- if (showTopToBottom != null && showTopToBottom!!.isRunning) {
|
|
|
|
|
|
+ if (showTopToBottom?.isRunning == true) {
|
|
if (showTopToBottom?.target == view) {
|
|
if (showTopToBottom?.target == view) {
|
|
showTopToBottom?.cancel()
|
|
showTopToBottom?.cancel()
|
|
showTopToBottom = null
|
|
showTopToBottom = null
|
|
@@ -253,7 +252,7 @@ class AnimationUtil private constructor() {
|
|
* @param view
|
|
* @param view
|
|
*/
|
|
*/
|
|
fun hideViewFromBottomToTop(view: View?, duration: Long = 300) {
|
|
fun hideViewFromBottomToTop(view: View?, duration: Long = 300) {
|
|
- if (showTopToBottom != null && showTopToBottom!!.isRunning) {
|
|
|
|
|
|
+ if (showTopToBottom?.isRunning == true) {
|
|
if (showTopToBottom?.target == view) {
|
|
if (showTopToBottom?.target == view) {
|
|
showTopToBottom?.cancel()
|
|
showTopToBottom?.cancel()
|
|
showTopToBottom = null
|
|
showTopToBottom = null
|
|
@@ -285,7 +284,7 @@ class AnimationUtil private constructor() {
|
|
}
|
|
}
|
|
|
|
|
|
fun showViewFromLeftToRight(view: View?, duration: Long = 300) {
|
|
fun showViewFromLeftToRight(view: View?, duration: Long = 300) {
|
|
- if (showLeftToRight != null && showLeftToRight!!.isRunning) {
|
|
|
|
|
|
+ if (showLeftToRight?.isRunning == true) {
|
|
if (showLeftToRight?.target == view) {
|
|
if (showLeftToRight?.target == view) {
|
|
showLeftToRight?.cancel()
|
|
showLeftToRight?.cancel()
|
|
showLeftToRight = null
|
|
showLeftToRight = null
|
|
@@ -317,7 +316,7 @@ class AnimationUtil private constructor() {
|
|
}
|
|
}
|
|
|
|
|
|
fun hideViewFromRightToLeft(view: View?, duration: Long = 300) {
|
|
fun hideViewFromRightToLeft(view: View?, duration: Long = 300) {
|
|
- if (showLeftToRight != null && showLeftToRight!!.isRunning) {
|
|
|
|
|
|
+ if (showLeftToRight?.isRunning == true) {
|
|
if (showLeftToRight?.target == view) {
|
|
if (showLeftToRight?.target == view) {
|
|
showLeftToRight?.cancel()
|
|
showLeftToRight?.cancel()
|
|
showLeftToRight = null
|
|
showLeftToRight = null
|