File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
library/src/main/java/com/opensource/svgaplayer Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -145,14 +145,16 @@ open class SVGAImageView : ImageView {
145
145
drawable.videoItem?.let {
146
146
var durationScale = 1.0
147
147
val animator = ValueAnimator .ofInt(0 , it.frames - 1 )
148
- Class .forName(" android.animation.ValueAnimator" )?.let {
149
- it.getDeclaredField(" sDurationScale" )?.let {
150
- it.isAccessible = true
151
- it.getFloat(Class .forName(" android.animation.ValueAnimator" ))?.let {
152
- durationScale = it.toDouble()
148
+ try {
149
+ Class .forName(" android.animation.ValueAnimator" )?.let {
150
+ it.getDeclaredField(" sDurationScale" )?.let {
151
+ it.isAccessible = true
152
+ it.getFloat(Class .forName(" android.animation.ValueAnimator" ))?.let {
153
+ durationScale = it.toDouble()
154
+ }
153
155
}
154
156
}
155
- }
157
+ } catch (e : Exception ) {}
156
158
animator.interpolator = LinearInterpolator ()
157
159
animator.duration = (it.frames * (1000 / it.FPS ) / durationScale).toLong()
158
160
animator.repeatCount = if (loops <= 0 ) 99999 else loops - 1
You can’t perform that action at this time.
0 commit comments