glide icon indicating copy to clipboard operation
glide copied to clipboard

Picture is not complete

Open libanghui opened this issue 11 years ago • 6 comments

Picture is not complete

libanghui avatar Apr 17 '15 14:04 libanghui

Download the picture sometimes is not complete

libanghui avatar Apr 17 '15 14:04 libanghui

Which version do you use? (你使用哪个版本?) How do you load the image? (你如何加载的形象呢?) Is there an Exception in LogCat? (是否有LogCat Exception?)

TWiStErRob avatar Apr 17 '15 15:04 TWiStErRob

ivHd.getLayoutParams().width = Device.getWidth();
            ivHd.getLayoutParams().height = Device.getWidth()*15/32;
            Glide.with(WeiBoListNewActivity.this).load(hd.ImageUrl).placeholder(R.color.guidColor).error(R.color.guidColor)
            .override(Device.getWidth(), Device.getWidth()*15/32)
            .crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop()
            .transform(new BitmapTransformation(WeiBoListNewActivity.this) {
                @Override
                public String getId() {
                    return Device.getMD5String(hd.ImageUrl);
                }

                @Override
                protected Bitmap transform(BitmapPool arg0, Bitmap source, int arg2, int arg3) {
                    x = source.getWidth();
                    y = source.getHeight();
                    return source;
                }
            })
            .listener(new RequestListener<Object, GlideDrawable>() {
                @Override
                public boolean onException(Exception arg0, Object arg1,
                        Target<GlideDrawable> arg2, boolean arg3) {
                    return false;
                }

                @Override
                public boolean onResourceReady(GlideDrawable arg0, Object arg1,
                        Target<GlideDrawable> arg2, boolean arg3, boolean arg4) {
                    if(x >0 && y>0) {
                        setXY(x, y);
                        LinearLayout.LayoutParams a = new LinearLayout.LayoutParams(Device.getWidth(), Device.getWidth()*y/x);
                        ivHd.setLayoutParams(a);
                        Glide.with(WeiBoListNewActivity.this).load(hd.ImageUrl).placeholder(R.color.guidColor).error(R.color.guidColor)
                        .override(Device.getWidth(), Device.getWidth()*y/x)
                        .crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop()
                        .into(ivHd);
                    } else {
                        int x1 = 32, y1 = 15;
                        if(getX()>0 && getY()>0) {
                            x1 = getX();
                            y1 = getY();
                        }
                        ivHd.getLayoutParams().width = Device.getWidth();
                        ivHd.getLayoutParams().height = Device.getWidth()*y1/x1;
                        Glide.with(WeiBoListNewActivity.this).load(hd.ImageUrl).placeholder(R.color.guidColor).error(R.color.guidColor)
                        .override(Device.getWidth(), Device.getWidth()*y1/x1)
                        .crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop()
                        .into(ivHd);
                    }
                    return true;
                }
            })
            .into(ivHd);

At first I did not know the size of the picture, get the size of the download is complete, and then reloaded into imageview in

libanghui avatar Apr 17 '15 15:04 libanghui

If you're referring to a partial image, it may have been fixed here: https://github.com/bumptech/glide/commit/64be9d314814f541fe1bb20553c7501d6e8c987b#diff-a5c571a05a090ccc55c81f4af74be5cf.

Try the latest Snapshot and see if you can still reproduce.

sjudd avatar Apr 18 '15 01:04 sjudd

thank you screenshot_2015-04-18-17-38-59 1

libanghui avatar Apr 18 '15 05:04 libanghui

This problem is likely to occur twice in a row to perform downloads

libanghui avatar Apr 18 '15 09:04 libanghui