Cardview: [Android] Add possibility to work with CardsView with "Disabled animations" setting

Created on 23 Aug 2018  ·  26Comments  ·  Source: AndreiMisiukevich/CardView

I'm on version 1.6.1 and I've initialized it using 3 pages like this:

<cards:CarouselView IsCyclical="false" SelectedIndex="{Binding CurrentIndex}">
        <cards:CarouselView.ItemsSource>
            <x:Array Type="{x:Type View}">
                <ContentView>
.. page goes here..
                </ContentView>
                <ContentView>
.. page goes here..
                </ContentView>
                <ContentView>
.. page goes here..
                </ContentView>
            </x:Array>
        </cards:CarouselView.ItemsSource>
        <controls:IndicatorsControl />
</cards:CarouselView>

And the appearance on a Samsung device is totally messed up once you begin swiping.

Any ideas what the issue might be?
It runs perfectly on iOS devices and on a Blackview A20 phone.

enhancement resolved

All 26 comments

Hi Karl @karlingen
hmm, can you confirm, that you didn't switch off animations on that phone?

https://lifehacker.com/disable-animations-on-android-to-improve-performance-1583554900

What about simulator? If you send me a sample, I can try to test it on my Xiaomi Redmi 4 and Samsung simulators via Genymotion

The app can be downloaded from here https://play.google.com/store/apps/details?id=se.codehacker.RePT

The initial wizard that is displayed when the app launches uses CardView

Since I don't own a Samsung device I cannot confirm that the animation was turned off.
This was reported from a Beta-tester and I've tried it on Samsung Test Lab and had the same issue there.

My device isn't compatible with this app. (I have Android 6.0)

@AndreiMisiukevich https://play.google.com/apps/testing/se.codehacker.RePT
Try the latest beta, it should have support for v6 and up.

Could you send me video with this issue?
And I need a small sample with code for reproducing that issu

Oh boy, I just tried it in a simulator with animations disabled. And I get that exact problem!
So my beta-tester probably had animations disabled and the same must've been the case when I tried it on Samsung Test Lab. 🤦‍♂️ 🤦‍♂️ 🤦‍♂️

Thanks for the heads up....

Haha) Just wanted to say, that on my Xiaomi it works fine)

So, i'm glad to read it =) Enjoy

I already did man, long time ago! 👍 It's pure awesomeness!

You might have solved my other error-reports that I have received from the Beta-tester 😂 There were some other places in the app that were causing issues due to animation.

You are welcome !)

So correct me if I'm wrong. But shouldn't applications work although users disable their animation?
Like, show next page but without animating to it.

@karlingen good question, you can investigate this point
I use regular Animation class from Xamarin "box" =)

I should be able to disable animation for the Carousel if I extend the created processors, right?
I'm thinking of adding a check wether device has animation disabled or not and reflect that setting to the animator for the Carousel. :)

@karlingen if you find, how to check it, it would be awesome to get PR from you =)
I will add it to code xD

This piece of code works for checking if animations are disabled on Android:

c# using Android.Provider; ... public bool AnimationsAreDisabled() { return Settings.Global.GetFloat(Application.ContentResolver, Settings.Global.AnimatorDurationScale, 1) <= 0; }

@karlingen do you want to contribute to this project ?)
You may create Interface IAnimationsChecker there https://github.com/AndreiMisiukevich/CardView/tree/master/PanCardView/Utility
-> Create AnimationsChecker service for android https://github.com/AndreiMisiukevich/CardView/tree/master/PanCardView.Droid

Just one Property AreAnimationsEnabled

I just tried (before seeing your answer) to implement a NoAnimationCarouselFronViewProcessor and NoAnimationCarouselFrontViewProcessor and it was a pain!

So your solution might work better, if you have plans on fixing it after I've implemented what you've asked for 😊

I can create the interface and the AnimationsChecker service for android. But then what? Will you take over from there?

@karlingen yes, that's right
Or I can do all work myself

@AndreiMisiukevich PR created :) As iOS and UWP don't have the option to disable animations, we don't need to create services for them I suppose.

Now what is left is the actual logic for disabling animations.

@karlingen hey) try please 1.6.2-pre version of this package

@AndreiMisiukevich It works perfectly. Good job!!!!

@karlingen very well
I will add it in next stable release for sure =)

@karlingen could you explain this problem there https://github.com/xamarin/Xamarin.Forms/issues/3694

@AndreiMisiukevich you already explained it in the issue. What else could I add to it?

@karlingen hm, probably we need to create sample for them
Or just hold on this issue )

Was this page helpful?
0 / 5 - 0 ratings

Related issues

2092015 picture 2092015  ·  5Comments

EldinHb picture EldinHb  ·  8Comments

troyvnit picture troyvnit  ·  8Comments

LeoJHarris picture LeoJHarris  ·  3Comments

alicint picture alicint  ·  3Comments