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

When placeholder is replaced by image it keeps with the size of placeholder when using .override(size, size) #542

Closed
forlayo opened this issue Jul 16, 2015 · 7 comments
Labels

Comments

@forlayo
Copy link

forlayo commented Jul 16, 2015

Hello gentlemen,

I'm using your library on a listview to load images, these images are being transformed to fit the max width of my layout using override but my placeholder have max dimensions for height/width; after dowloading and showing final image it keeps with the same size and aspect ratio than placeholder.

After doing scroll it appear with proper size.

                holder.mMultimediaLoadingProgress.setVisibility(View.VISIBLE);

                int size = (int) mContext.getResources().getDimension(R.dimen.chat_message_text_max_long); // 250dp

                Glide.with(mContext)
                        .load(msg.getMultimediaLink())
                        .placeholder(R.drawable.multimedia_placeholder)
                        .override(size, size)
                        .listener(new RequestListener<String, GlideDrawable>() {
                            @Override
                            public boolean onException(Exception e, String model, Target<GlideDrawable> target,
                                    boolean isFirstResource) {
                                holder.mMultimediaLoadingProgress.setVisibility(View.GONE);
                                return false;
                            }

                            @Override
                            public boolean onResourceReady(GlideDrawable resource, String model,
                                    Target<GlideDrawable> target,
                                    boolean isFromMemoryCache, boolean isFirstResource) {
                                holder.mMultimediaLoadingProgress.setVisibility(View.GONE);
                                return false;
                            }
                        })
                        .into(holder.mMsgImage);
                <ImageView
                    android:id="@+id/conversation_chat_list_item_msg_image"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:scaleType="fitCenter" />
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <item>
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle">
            <size
                android:width="@dimen/chat_message_text_max_long"
                android:height="@dimen/chat_message_text_max_long" />
        </shape>
    </item>

    <item>
        <bitmap android:src="@drawable/ic_file_image_box" android:gravity="center"/>
    </item>

</layer-list>

How can I manage this ?

Thanks a lot for you really good work, regards.

@TWiStErRob
Copy link
Collaborator

Big thanks for the detailed report!
I think this is a duplicate of #386 and hence #363 or at least highly related. You can subscribe to #363 if you want updates.

Workaround is probably dontAnimate() or animate(fade_in) if this is caused by TransitionDrawable too and it seems so becuase after scroll there's no animation because it's cached.

@forlayo
Copy link
Author

forlayo commented Jul 21, 2015

@TWiStErRob dontAnimate() fix this behavior, thanks a lot :)

@mddanishansari
Copy link

mddanishansari commented Sep 2, 2020

dontAnimate() didn't solve my issue

This is my code

Glide.with(imgView.context)
	.load(imageUrl)
	.placeholder(placeholderImage)
	.dontAnimate()
	.into(imgView)

I'm using v4.11.0 of Glide.
Note: If I don't use the placeholder, image loads perfectly fine. My problem is exactly as the title of this issue describes.

@whiteLT
Copy link

whiteLT commented Sep 18, 2020

dontAnimate() didn't solve my issue

This is my code

Glide.with(imgView.context)
	.load(imageUrl)
	.placeholder(placeholderImage)
	.dontAnimate()
	.into(imgView)

I'm using v4.11.0 of Glide.
Note: If I don't use the placeholder, image loads perfectly fine. My problem is exactly as the title of this issue describes.

Me too :/

@DeepanAndroid
Copy link

DeepanAndroid commented Oct 26, 2020

dontAnimate() didn't solve my issue

Glide.with(context!!)
.load(url)
.apply(RequestOptions()
.placeholder(R.drawable.placeholder)
.error(R.drawable.error)
.dontAnimate()
)
.into(imgView)

I'm using --> com.github.bumptech.glide:glide:4.8.0

Note: If I don't use the placeholder, image loads perfectly fine. My problem is exactly as the title of this issue describes.

@Mikkelet
Copy link

Mikkelet commented Sep 8, 2021

Still getting this problem

Glide.with(this) .load(thumbnail) .placeholder(R.drawable.video_placeholder) .dontAnimate() .into(imageViewThumbnail)

@shettychethan4
Copy link

dontAnimate() didn't solve my issue

This is my code

Glide.with(imgView.context)
	.load(imageUrl)
	.placeholder(placeholderImage)
	.dontAnimate()
	.into(imgView)

I'm using v4.11.0 of Glide. Note: If I don't use the placeholder, image loads perfectly fine. My problem is exactly as the title of this issue describes.

Same here 😔

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

No branches or pull requests

7 participants