Narfss / ParallaxEverywhere

Parallax everywhere is a library with alternative android widgets with parallax effects.
MIT License
715 stars 96 forks source link

Not working with Glide #9

Open ghost opened 8 years ago

ghost commented 8 years ago

Dear, Thank you for great component. I have an issue. I am using Glide to download images. parallax is not working when using Glide. Please advise

TonyHaddad91 commented 8 years ago

@hishamBakr Have you solved your issue yet, it so bad decision to replace glide with any other image loader

ghost commented 7 years ago

Hey guys,

Override the PEWImageView like this:

`public class ParalaxImageView extends PEWImageView{

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

public ParalaxImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public ParalaxImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

@Override
public void setImageResource(int resId) {
    super.setImageResource(resId);
    invalidate();
}

@Override
public void setImageDrawable(Drawable drawable) {
    super.setImageDrawable(drawable);
    invalidate();
}

@Override
public void setImageBitmap(Bitmap bm) {
    super.setImageBitmap(bm);
    invalidate();
}

}`

And it will work fine.

I'll submit a pull request soon.

FelipeRRM commented 7 years ago

@ronaldo-getreveel Tried this but it still did not load. I'm loading the image in a recycler view using this calls:

Glide.with(context)
.load(atual.getImage())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.centerCrop()
.dontAnimate()
.into(holder.image);

am I missing anything?

FelipeRRM commented 7 years ago

Got it working, just had to use .override(1080,675), as Glide loads a cut version of the image to fit perfectly in the ImageView, not leaving room for the parallax effect.

sudansh commented 7 years ago

@FelipeRRM thanks for the tip. It worked.