Xamarin.forms: [Bug] Animations are not working in 4.2.0.709249

Created on 27 Aug 2019  路  19Comments  路  Source: xamarin/Xamarin.Forms

Description

I have some part of my apps that animates. Fading in and out and translating from A to B. They are all working in 4.1.0.673156 but after upgrading to 4.2.0.709249, animations are not working anymore. FadeTo and TranslateTo are getting called when debugging. But no animations are happening.

Steps to Reproduce

Use Xamarin.Forms version 4.1.0.673156 and have some small animations like FadeTo and TranslateTo then upgrade to the latest version: 4.2.0.709249

Expected Behavior

It should animate

Actual Behavior

It's not animating

Basic Information

  • Version with issue:
  • Last known good version: 4.1.0.673156
  • IDE: Visual Studio 2019 Preview 2
  • Platform Target Frameworks:

    • iOS: _I have only tested in Android_

    • Android: 8.1

    • UWP: _I have only tested in Android_

  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:
    Emulator and Xiaomi Redmi 5 Plus

Screenshots

n/a

Reproduction Link

n/a

animation 馃幀 regression Android unverified bug

Most helpful comment

Same problem, animations are completely broken on Android.

All 19 comments

In version 4.1.0.709244 - The animations are also working. So I'll stick with that version for the mean time until it's fixed in 4.2.0.X

Could you please see if #7255 describes your issue?

The same I guess but in my code, I am using these

GridCoursePreview.FadeTo(1, 300, Easing.CubicInOut);
await GridCoursePreview.TranslateTo(0, 0, 300, Easing.CubicInOut);

That let's my Grid fade in and scroll up fast when previewing a Course full description and same FadeTo and TranslateTo methods are used to close the Grid control.

anim_prev

I can only test in my actual device running Android 8.1 API 27 and Emulator which runs the same versions.

Same problem, animations are completely broken on Android.

Same problem for me. Animations completely disappeared at Android 9 with 4.3.0.1099-nightly.

Same problem

Yep, not working for me either

anyone got a workaround for this in version 4.2.0.709249 ? I need the Scrolled event in CollectionView which is only available in 4.2.0.709249

@Nullstr1ng Not one I'm aware of at this point, sorry. I see the fix is merged into 4.2 so a new release with the fix should be here in a reasonable amount of time.

@Nullstr1ng

Yes. If you're desperate, you can use reflection:

public static class ReflectionExtensions
    {
        static readonly Lazy<FieldInfo> _androidTicker_AnimatorEnabled;

        static ReflectionExtensions()
        {
            _androidTicker_AnimatorEnabled = new Lazy<FieldInfo>(Get_AndroidTicker_AnimatorEnabled);
        }

        static FieldInfo Get_AndroidTicker_AnimatorEnabled()
        {
            var type = Type.GetType("Xamarin.Forms.Platform.Android.AndroidTicker, Xamarin.Forms.Platform.Android", true);
            var fieldInfo = type.GetField("_animatorEnabled", BindingFlags.NonPublic | BindingFlags.Instance);
            return fieldInfo;
        }

        // Fix for https://github.com/xamarin/Xamarin.Forms/issues/7291
        public static void AndroidTicker_SetAnimatorEnabled()
        {
            try
            {
                var fieldInfo = _androidTicker_AnimatorEnabled.Value;
                fieldInfo.SetValue(Ticker.Default, true);
            }
            catch
            {
                Console.WriteLine("Error setting AndroidTicker._animatorEnabled via reflection.");
            }
        }
    }

Some animations fixed, but still broken in 4.2.0.778463
I have a visual.Rotateto and visualTranslateto. One or both of those is not working.

@samhouts Animations not working on 4.2.0.778463. It's like they are jumping to their end state and staying there, regardless of the other settings for the animation.

This is on Android 9.0, Samsung Galaxy S9+.

The workaround with developer options doesn't seem to work.

Nevermind, apparently it was caused by power saving mode!
@mdbill

@mdbill could you confirm that for you it also had to do with the power saving mode?

It's not power saving mode for me. I downgrade to 4.1 and it works again.
I'm using an 8.1 emulator and android 7 device.

It is fixed with 4.3.0.778476-pre1. I麓ve tested it on Samsung tablet and Huawai phone, iPad and UWP! It was not a power saving issue. Thanks for the fix Xamarin-Team.

That is great to hear @maexsp! Thanks!

@mdbill sorry to bother you once again but would it be possible to try 4.3-pre1 to see if that fixes your issue?

Yes, fixes my issue. Thanks!

I Confirm, it's fixed ! Thx

Was this page helpful?
0 / 5 - 0 ratings