Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glide load images in disorder #1561

Closed
shangmingchao opened this issue Nov 2, 2016 · 2 comments
Closed

Glide load images in disorder #1561

shangmingchao opened this issue Nov 2, 2016 · 2 comments

Comments

@shangmingchao
Copy link

shangmingchao commented Nov 2, 2016

Glide Version: glide:3.7.0

Integration libraries: none

Device/Android Version: Galaxy Note3/SM-N9500 5.0

Issue details / Repro steps / Use case background: Glide load images in disorder.

Glide load line / GlideModule (if any) / list Adapter code (if any):

public class MyGlideModule implements GlideModule {

    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        MemorySizeCalculator calculator = new MemorySizeCalculator(context);
        int defaultMemoryCacheSize = calculator.getMemoryCacheSize();
        int defaultBitmapPoolSize = calculator.getBitmapPoolSize();

        int customMemoryCacheSize = (int) (0.3 * defaultMemoryCacheSize);
        int customBitmapPoolSize = (int) (0.3 * defaultBitmapPoolSize);

        builder.setMemoryCache(new LruResourceCache(customMemoryCacheSize));
        builder.setBitmapPool(new LruBitmapPool(customBitmapPoolSize));
    }

    @Override
    public void registerComponents(Context context, Glide glide) {
    }
}

Layout XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_bg"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/tv_rank"
        android:layout_width="50dp"
        android:layout_height="match_parent"
        android:gravity="center" />

    <ImageView
        android:id="@+id/iv_logo"
        android:layout_width="60dp"
        android:layout_height="50dp"
        android:layout_margin="5dp"
        android:contentDescription="@string/app_name" />

    <TextView
        android:id="@+id/tv_name"
        android:layout_width="100dp"
        android:layout_height="match_parent"
        android:gravity="center" />

</LinearLayout>

Stack trace / LogCat: none

Glide load images in disorder when I use MyGlideModule.
disorder
Is there something wrong?
it's not happened without using MyGlideModule or in the Galaxy S4 device.
Here is the Repo.

@TWiStErRob
Copy link
Collaborator

At first glance this sounds like a duplicate of #601, please give that a read and let me know what you think.

@shangmingchao
Copy link
Author

Thanks, It's really the same problem. It works well when I add builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);. I've been trying to put some breakpoint and debug it before this. I thought it might be the problem of cache key. But the url of Glide loaded is always correct, the picture are not display correctly.
It doesn't always reproduce, I also didn't notice the logs about OpenGL. Your workarounds is well-founded, I agree with and support that, and I hope someone can give a more detailed explanation.
Thanks again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants