Issue 1:
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.

Is there something wrong?

it's not happened without using MyGlideModule or in the Galaxy S4 device.

Here is the Repo.

Issue 2:
In my app, I have a Recycler view with GridLayoutManager. The code I am using to load images bindImage method of recycler view adapter:

@Override
public void onBindViewHolder(ImageViewHolder holder, int position) {
GSImage dbImage = mLandscapeImagesList.get(position);
File imageFile = new File(mImageDirectoryFile, dbImage.getImageName());

Glide.with(MyImageFragement.this).load(imageFile).centerCrop().into(holder.imageView);

int indexInSelectedImagesSet = mSelectedLandscapeImages.indexOf(dbImage);
if (indexInSelectedImagesSet>-1){
holder.itemView.setSelected(true);
} else {
holder.itemView.setSelected(false);
}

}

The Cell layout I am using is:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/images_background"
android:layout_marginTop="9dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="0dp"
android:padding="2dp">

<com.gaurav.myProject.commons.AspectRatioImageView
android:id="@+id/image_thumb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
app:viewAspectRatio="1.33"/>

</RelativeLayout>

Here AspectRatioImageView(subclass of ImageView) automatically resizes the height of image view according to the provided aspect ratio.

The above code is working fine on my devices (Xiaomi MiPad, ViewSonic Tablet, Android emaulators and Samsung Galaxy S3) but is not working correctly on my client's device (Samsung 10.1 inch tablet).

In his end, images are being duplicated in the recycler grid. Also the the duplicates mostly occurs in adjacent recycler grid positions. I can't share any code as I even unable to reproduce the issue on my devices.

Do you guys have any idea what could the cause of this? Can you please suggest me any thing that I can try?

Thanks