AndroidImageSlider icon indicating copy to clipboard operation
AndroidImageSlider copied to clipboard

Using Glide instead of Picasso

Open peterkitonga opened this issue 8 years ago • 8 comments

I noticed the images stretch sometimes and do not re-size properly. I want to use Glide, how can I override Picasso so that I can use Glide?

peterkitonga avatar Aug 02 '16 12:08 peterkitonga

+1 , same question

alizarei95 avatar Aug 09 '16 08:08 alizarei95

do this

public class GlideSliderView extends BaseSliderView { protected void bindEventAndShow(final View v, ImageView targetImageView) { v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mOnSliderClickListener != null) { mOnSliderClickListener.onSliderClick(GlideSliderView.this); } } });

    if (targetImageView == null)
        return;

    if (mLoadListener != null) {
        mLoadListener.onStart(this);
    }
    RequestManager p = (mGlide != null) ? mGlide : Glide.with(mContext);
    DrawableTypeRequest rq = null;
    if (mUrl != null) {
        rq = p.load(mUrl);
    } else if (mFile != null) {
        rq = p.load(mFile);
    } else if (mRes != 0) {
        p.load(mRes);
    } else {
        return;
    }
    if (rq == null) {
        return;
    }
    if (getEmpty() != 0) {
        rq.placeholder(getEmpty());
    }
    if (getError() != 0) {
        rq.error(getError());
    }
    v.findViewById(com.daimajia.slider.library.R.id.loading_bar).setVisibility(View.INVISIBLE);
    rq.diskCacheStrategy(DiskCacheStrategy.ALL).thumbnail(0.1f).skipMemoryCache(true).centerCrop().into(targetImageView);

} }

han361769045 avatar Aug 24 '16 01:08 han361769045

This works only if you download the library, because you need to change some super properties from private to protected. But thanks anyway.

sagits avatar Nov 04 '16 15:11 sagits

public class GlideSliderView extends DefaultSliderView {

    public GlideSliderView(Context context) {
        super(context);
    }

    protected void bindEventAndShow(final View v, ImageView targetImageView) {
        View progressBar = v.findViewById(com.daimajia.slider.library.R.id.loading_bar);
        if (progressBar != null) {
            progressBar.setVisibility(View.GONE);
        }

        Glide.with(getContext())
                .load(getUrl())
                .centerCrop()
                .crossFade()
                .into(targetImageView);
    }
}

vyarovyi avatar Nov 09 '16 23:11 vyarovyi

its not working.images not loaded from url :(

arunrajgm avatar Nov 19 '16 12:11 arunrajgm

can i load images from json? i've tried but the images not appear

ijal11 avatar Dec 05 '16 05:12 ijal11

Pull request #289 is an implementation that splits the library into a "picasso" and "glide" product type so that you can choose which image library to use. The demo app in that PR was changed over to use the glide implementation for testing/reference.

c0state avatar Jan 27 '17 07:01 c0state

You can check this library https://github.com/OpenSooq/Pluto it has the ability to have full control over your views and layout and not depending on any image library

tamtom avatar May 05 '19 11:05 tamtom