glide icon indicating copy to clipboard operation
glide copied to clipboard

Problem with StaggeredGridLayoutManager variable height

Open KaeMs opened this issue 10 years ago • 3 comments

Glide Version: 3.7.0

Integration libraries: OkHttp3

Device/Android Version: Asus Zenfone C 4.4.2

Issue details / Repro steps / Use case background: Creating a two column - StaggeredGridLayout using StaggeredGridLayoutManager. I am using minimum height and maximum height of the picture which causes the variable height of the image. The problem is after I load a lot of images by scrolling down using infinite scroll, the ViewHolders gets shuffled when I scroll back up. And it feels stutter..-y..

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

Glide.with(context)
    .load(fulluserPostImageUri)
    .diskCacheStrategy(DiskCacheStrategy.ALL)
    .skipMemoryCache(true)
    .centerCrop()
    .dontTransform()
    .placeholder(R.color.miGrey)
    .into(postViewHolder.contentImage);

// This is how I set min and max height
postViewHolder.contentImage.setMinimumHeight(height * Constants.pictureMinHeight / 100);
postViewHolder.contentImage.setMaxHeight(height * Constants.pictureMaxHeight / 100);

Layout XML:

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Image Wrapper -->
    <RelativeLayout
        android:id="@+id/post_content_image_wrapper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp">

        <ImageView
            android:id="@+id/post_content_image"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:contentDescription="@string/lobbyImageDesc"
            android:adjustViewBounds="true"/>

        <TextView
            android:id="@+id/post_content_youtubeTxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:layout_centerInParent="true"
            android:gravity="center"
            android:text="@string/playOnYoutube"
            android:textSize="@dimen/font_size"
            android:textColor="@color/white"
            android:visibility="gone"/>

    </RelativeLayout>
<!---->
</merge>

Stack trace / LogCat: Nope

KaeMs avatar Nov 16 '16 04:11 KaeMs

What is the problem?

TWiStErRob avatar Nov 16 '16 09:11 TWiStErRob

HAHA I described stuffs but forgot to say the problem, the problem is when I scroll back up after scrolling down and loading a lot of images, the ViewHolders gets shuffled and resizing occurs..

KaeMs avatar Nov 16 '16 10:11 KaeMs

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

stale[bot] avatar Nov 12 '17 07:11 stale[bot]