alexjlockwood / ShapeShifter

SVG icon animation tool for Android, iOS, and the web
https://shapeshifter.design
Apache License 2.0
3.97k stars 200 forks source link

AnimatedVectorDrawable export not animating Galaxy S7 8.0.0 #300

Closed ersin-ertan closed 6 years ago

ersin-ertan commented 6 years ago

After exporting the AnimatedVectorDrawable and upon running, only first frame shows, onAnimationStart and onAnimationEnd are called in quick succession, but the animation does not appear on screen.

with(findViewById<AppCompatImageView>(R.id.my_avd).drawable){
                if(this is AnimatedVectorDrawable){
                    registerAnimationCallback(object: Animatable2.AnimationCallback() {
                        override fun onAnimationStart(drawable: Drawable?) {
                            super.onAnimationStart(drawable)
                        }
                        override fun onAnimationEnd(drawable: Drawable?) {
                            super.onAnimationEnd(drawable)
                        }
                    })
                    start()
                }
            }
targetSdkVersion 28
compileSdkVersion 28
minSdkVersion 26
implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0-beta01'
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'

Testing device: Android 8.0.0 Samsung Galaxy S7 Shapeshifter and AnimatedVectorDrawable export file attached: myAvdAndShapshifter.zip

alexjlockwood commented 6 years ago

I think you may need to use if (this is AnimatedVectorDrawableCompat) instead?

I would confirm that the call to start() is actually happening... if it isn't then that sounds like the problem. If it is, then LMK.

ersin-ertan commented 6 years ago

I've tried both, the if only continues with AnimatedVectorDrawable. Both registerAnimationCallback and start are called, which then calls onAnimationStart/End. I've also moved start into a button click, and onAnimationStart/End is still called one after each other.

alexjlockwood commented 6 years ago

Are you setting the drawable in XML using app:srcCompat="@drawable/my_avd"?

Because if you are then you will need to cast the drawable to Animatable, which covers both cases where the drawable is either an AnimatedVectorDrawable or an AnimatedVectorDrawableCompat.

Will check to see why your drawable isn't running shortly...

alexjlockwood commented 6 years ago

Can you import this sample project and try it out? The animation plays fine for me... VectorSample.zip

ersin-ertan commented 6 years ago

Pre-click left, post right - no animation 20180723_171505 I guess this is a devices specific problem, if anyone with a Samsung Galaxy S7 would like to confirm.

ersin-ertan commented 6 years ago

Image on the left is before I clicked on the content. Image on the right is after I clicked on the content. Animation does not show, it switches from left image to right image in a single frame.

On Mon, 23 Jul 2018 at 17:45, Alex Lockwood notifications@github.com wrote:

What do you mean by "pre click left" and "post right - no animation"?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alexjlockwood/ShapeShifter/issues/300#issuecomment-407211237, or mute the thread https://github.com/notifications/unsubscribe-auth/AElkfcEsCaepKGWHVahOYUqAHkl7rHZ2ks5uJkPdgaJpZM4VbZ9t .

alexjlockwood commented 6 years ago

Did you mean to close the issue? Did you solve the problem?

ersin-ertan commented 6 years ago

Since the animation is working for you with regards to the VectorSample but not for me, then the diff is the hardware. This is a problem outside the scope of Shapeshifter, no?

alexjlockwood commented 6 years ago

Yeah pretty much...

Do you have another device to test with? Maybe try it with the emulator? I really have no clue why it isn't working for you...

ersin-ertan commented 6 years ago

It may be concerning that the animation is not playing correctly on test phone: https://youtu.be/nsDxiwWqc6Q

alexjlockwood commented 6 years ago

Which phone is that?

ersin-ertan commented 6 years ago

lg optimus l9 p769 - Android 4.1.2

alexjlockwood commented 6 years ago

I mean... to be honest it sounds like you may have found a bug in the support library at this point. :|

If you can reproduce this issue on an emulator running Android 4.1 then let me know... I can forward the issue to Google b/c it sounds like a bug with them.

ersin-ertan commented 6 years ago

Ok thanks Alex and sorry to bother you about this within ShapeShifter. Reproduced; the 4.1 emulator performed exactly the same as the LG Optimus L9 P769 device.

alexjlockwood commented 6 years ago

Do you mind if I use your AnimatedVectorDrawable as an example in my bug report to Google? I can replace the paths with random shapes if you like.

ersin-ertan commented 6 years ago

Feel free to use it as is

alexjlockwood commented 6 years ago

Filed! https://issuetracker.google.com/issues/111780277

ersin-ertan commented 6 years ago

I had turned my animations off long ago to conserve battery, and today was the first time they have been turned on; animations are working. At least a bug report for another issue came out of this :+1: