-
Notifications
You must be signed in to change notification settings - Fork 413
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
兼容 Glide3 #118
Comments
bingoogolapple
added a commit
that referenced
this issue
Dec 1, 2017
Closed
非常感谢作者,提到问题立马修改,谢谢。 |
我按照这样设置Glide3 |
兼容最新版Glide 4.9.0如下 /**
* 兼容本项目中最新版Glide 4.9.0
*/
public class BGAGlideImageLoader490 extends BGAImageLoader {
@Override
public void display(ImageView imageView, String path, int loadingResId, int failResId, int width, int height, DisplayDelegate delegate) {
final String finalPath = getPath(path);
Activity activity = getActivity(imageView);
Glide.with(activity).load(finalPath).placeholder(loadingResId).error(failResId).override(width, height).dontAnimate().listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
if (delegate != null) {
delegate.onSuccess(imageView, finalPath);
}
return false;
}
}).into(imageView);
}
@Override
public void download(String path, DownloadDelegate delegate) {
final String finalPath = getPath(path);
Glide.with(BGABaseAdapterUtil.getApp()).asBitmap().load(finalPath).into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
if (delegate != null) {
delegate.onSuccess(finalPath, resource);
}
}
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
if (delegate != null) {
delegate.onFailed(finalPath);
}
}
});
}
@Override
public void pause(Activity activity) {
Glide.with(activity).pauseRequests();
}
@Override
public void resume(Activity activity) {
Glide.with(activity).resumeRequestsRecursive();
}
} |
Glide 4.11.0 亲测可用,感谢分享 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: