mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
7aeacfd308
commit
c60edaa0fc
@ -16,14 +16,17 @@
|
|||||||
package io.legado.app.ui.widget.anima.explosion_field
|
package io.legado.app.ui.widget.anima.explosion_field
|
||||||
|
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.graphics.*
|
import android.graphics.*
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.animation.AccelerateInterpolator
|
import android.view.animation.AccelerateInterpolator
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
|
@SuppressLint("Recycle")
|
||||||
class ExplosionAnimator(private val mContainer: View, bitmap: Bitmap, bound: Rect) :
|
class ExplosionAnimator(private val mContainer: View, bitmap: Bitmap, bound: Rect) :
|
||||||
ValueAnimator() {
|
ValueAnimator() {
|
||||||
|
|
||||||
private val mPaint: Paint = Paint()
|
private val mPaint: Paint = Paint()
|
||||||
private val mParticles: Array<Particle?>
|
private val mParticles: Array<Particle?>
|
||||||
private val mBound: Rect = Rect(bound)
|
private val mBound: Rect = Rect(bound)
|
||||||
|
@ -24,8 +24,8 @@ import android.graphics.Canvas
|
|||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import timber.log.Timber
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
@ -99,8 +99,6 @@ class ExplosionView @JvmOverloads constructor(context: Context, attrs: Attribute
|
|||||||
view.getGlobalVisibleRect(r)
|
view.getGlobalVisibleRect(r)
|
||||||
val location = IntArray(2)
|
val location = IntArray(2)
|
||||||
getLocationOnScreen(location)
|
getLocationOnScreen(location)
|
||||||
// getLocationInWindow(location);
|
|
||||||
// view.getLocationInWindow(location);
|
|
||||||
r.offset(-location[0], -location[1])
|
r.offset(-location[0], -location[1])
|
||||||
r.inset(-mExpandInset[0], -mExpandInset[1])
|
r.inset(-mExpandInset[0], -mExpandInset[1])
|
||||||
val startDelay = 100
|
val startDelay = 100
|
||||||
@ -128,11 +126,11 @@ class ExplosionView @JvmOverloads constructor(context: Context, attrs: Attribute
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onAnimationCancel(animator: Animator) {
|
override fun onAnimationCancel(animator: Animator) {
|
||||||
Log.i("PRUEBA", "CANCEL")
|
Timber.i("CANCEL")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAnimationRepeat(animator: Animator) {
|
override fun onAnimationRepeat(animator: Animator) {
|
||||||
Log.i("PRUEBA", "REPEAT")
|
Timber.i("REPEAT")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user