Glide: Android 4.1.2 - Image/Gif Very slow loading

Created on 27 Aug 2015  路  4Comments  路  Source: bumptech/glide

Glide Version/Integration library (if any): 3.6.0/OKHTTP
Device/Android Version: Samsung S3 mini/4.1.2
Issue details/Repro steps/Use case background:

Images and Gifs take a very long time to load into image view. They are coming from a server. When Gif loads, it then takes a number of seconds before it animates. I have also tested on Samsung S4 and it works fine, however, as it stands it can't be used due to how slow it is.

Glide load line:

Glide.get(itemView.getContext()).register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(new OkHttpClient()));
Glide.with(itemView.getContext()).load(feedContent.getMedia().getMediaUrl()).placeholder(R.drawable.placeholder).into(image);

Layout XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <android.support.v7.widget.CardView
        android:layout_margin="@dimen/feed_item_margin"
        app:cardBackgroundColor="@color/lightGrey"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/cv">

        <RelativeLayout
            android:id="@+id/anchor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <include
                android:id="@+id/content_header"
                android:layout_marginRight="@dimen/feed_item_margin"
                android:layout_marginLeft="@dimen/feed_item_margin"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                layout = "@layout/content_item_header_layout"
                />

            <ImageView
                android:id="@+id/image"
                android:layout_centerHorizontal="true"
                android:textColor="@color/secondaryText"
                android:layout_below="@+id/content_header"
                android:layout_marginTop="@dimen/feed_item_margin"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:id="@+id/text_holder1"
                android:lines="1"
                android:textStyle="bold"
                android:ellipsize="end"
                android:layout_marginRight="@dimen/feed_item_margin"
                android:layout_marginLeft="@dimen/feed_item_margin"
                android:layout_below="@+id/image"
                android:textColor="@color/primaryText"
                android:layout_marginTop="@dimen/feed_item_margin"
                android:text="Heading"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <TextView
                android:id="@+id/text_holder2"
                android:layout_below="@+id/text_holder1"
                android:textColor="@color/secondaryText"
                android:maxLines="4"
                android:ellipsize="end"
                android:text="body"
                android:layout_marginRight="@dimen/feed_item_margin"
                android:layout_marginLeft="@dimen/feed_item_margin"
                android:layout_marginTop="@dimen/feed_item_margin"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <include
                android:id="@+id/content_footer"
                android:layout_marginRight="@dimen/feed_item_margin"
                android:layout_marginLeft="@dimen/feed_item_margin"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:layout_below="@+id/text_holder2"
                layout = "@layout/content_item_footer_layout"/>
        </RelativeLayout>
    </android.support.v7.widget.CardView>
</RelativeLayout>
question

Most helpful comment

Sounds like a dupe, take a look at #281: Sam says there, for GIFs use:

.diskCacheStrategy(DiskCacheStrategy.SOURCE)

The time between the download finish and the displaying is the RESULT caching: the encoder writes the resized frames into a new GIF.

You'll find a lot of related issues with varying amounts of explanations starting from #281.

All 4 comments

Sounds like a dupe, take a look at #281: Sam says there, for GIFs use:

.diskCacheStrategy(DiskCacheStrategy.SOURCE)

The time between the download finish and the displaying is the RESULT caching: the encoder writes the resized frames into a new GIF.

You'll find a lot of related issues with varying amounts of explanations starting from #281.

That may fix the GIF issue but there is the same issue for images also..

Setting SOURCE is a workaround for 3.0 (which has an unfortunate default for GIFs). The general issue is already fixed, but in 4.0: https://github.com/bumptech/glide/issues/150#issuecomment-110363410

I agree this is a dupe of #281.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kenneth2008 picture kenneth2008  路  3Comments

FooBarBacon picture FooBarBacon  路  3Comments

Ncit picture Ncit  路  3Comments

sergeyfitis picture sergeyfitis  路  3Comments

Tryking picture Tryking  路  3Comments