Coder Social home page Coder Social logo

Adding ColorPickerView causes significant animation lag when starting an activity using makeSceneTransitionAnimation about hsv-alpha-color-picker-android HOT 6 CLOSED

martin-stone avatar martin-stone commented on August 15, 2024
Adding ColorPickerView causes significant animation lag when starting an activity using makeSceneTransitionAnimation

from hsv-alpha-color-picker-android.

Comments (6)

martin-stone avatar martin-stone commented on August 15, 2024

Hi. I'm not sure what I should be looking at in that image. Is it the right link?

A similar issue has cropped up before (#28), and it isn't immediately obvious to me where the bottleneck is. If you could run a profiler on your app and let me know which colorpicker functions show up as slow, that would be very useful.

from hsv-alpha-color-picker-android.

IvanBrazza avatar IvanBrazza commented on August 15, 2024

Hi, apologies if that wasn't clear, it should be a video showing that when the ColorPickerView is included (i.e. in the view when "Family Bathroom Lightstrip" is clicked) there's a lot of lag in the transition animation.

I ran a method profile and it looks like it's the onSizeChanged callback running makeBitmap a lot that's causing the issue:

image

Perhaps there could be a way to rate limit the callback?

from hsv-alpha-color-picker-android.

martin-stone avatar martin-stone commented on August 15, 2024

Ah -- I see the video now: Was getting confused by the hover behaviour and thought it was a GIF.

So I suppose when the size of the view is animated it's generating a lot of bitmaps -- I'll investigate.

Is there a way of animating these views by cropping out the child view? (I.e. have the color picker stay the same size and just be revealed when the card grows.) That might be the most effective workaround -- It would avoid a lot of layout recalculation as well as the bitmap generation.

from hsv-alpha-color-picker-android.

martin-stone avatar martin-stone commented on August 15, 2024

I've pushed a commit which should improve your animations. I haven't released a new version to jcenter yet -- still experimenting with generating the bitmap in a worker thread -- but if you build the library from source you can try it out now.

from hsv-alpha-color-picker-android.

IvanBrazza avatar IvanBrazza commented on August 15, 2024

I did look for a callback for when the animation is complete, but I couldn't find one; which is strange because there's one for before it starts...

However, your commit worked! The animations are buttery smooth now that the bitmap is only being drawn once. Thanks for your help and for a great library - and have a great new year :)

from hsv-alpha-color-picker-android.

martin-stone avatar martin-stone commented on August 15, 2024

Great! I've published an official release with this fix (version 2.1.0) so you can go back to using the jcenter dependency if you prefer.

Thanks for your help.

from hsv-alpha-color-picker-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.