Giter VIP home page Giter VIP logo

Comments (5)

JVillella avatar JVillella commented on July 16, 2024

Hey @AngleV! I assume you are talking about the sample project. Is that correct?

from greedo-layout-for-android.

AngleV avatar AngleV commented on July 16, 2024

@JVillella
Yes that's right !!!

from greedo-layout-for-android.

JVillella avatar JVillella commented on July 16, 2024

Ah ok, that's helpful. The sample project uses Picasso to load the drawables into the ImageViews while scrolling. It seems that this operation is the culprit and will require further investigation. We have specified a large enough in-memory cache for Picasso, but it doesn't change anything. If you use this outside the sample, and load in images some other way, it shouldn't be a problem. Nevertheless, I'll take a further look at this. Thank you!

from greedo-layout-for-android.

adamalyyan avatar adamalyyan commented on July 16, 2024

I noticed that the sample is initially chopping, but it's fine after that. Digging a little deeper, it looks like some heavy work is being done in aspectRatioForIndex, namely line 26 of PhotosAdapter:

Drawable drawable = mContext.getResources().getDrawable(mImageResIds[index]);

I added some logs and it was taking anywhere between 70ms to 115ms. Removing that line causes the choppiness to go away (I just returned 1.0 as a test). Just wanted to save you the trouble of searching around!

from greedo-layout-for-android.

JVillella avatar JVillella commented on July 16, 2024

Hey @a64adam! Appreciate it! I believe this is correct. This synchronous call to getDrawable(...) is causing a slow down. Picasso is doing its work off the main thread. I've replaced the getDrawable(...) with a BitmapFactory.decode(...) and query strictly for the bounds. I also now precompute this data so it's not being continuously calculated. Thanks!

from greedo-layout-for-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.