storageReference.child("ProfilePicture")
.child(currUser.getUid())
.getDownloadUrl()
.addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
profilePicture = storageReference.child("ProfilePicture").child(currUser.getUid());
Glide.with(getBaseContext())
.using(new FirebaseImageLoader())
.load(profilePicture)
.signature(new StringSignature(String.valueOf(System.currentTimeMillis())))
.into(profilePictures)
.listener(new RequestListener<URL, GlideDrawable>() {
@Override
public boolean onException(Exception e, URL model, Target<GlideDrawable> target, boolean isFirstResource) {
progressDialogCreate.hide();
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, URL model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
progressDialogCreate.hide();
return false;
}
});
profilePictures.setVisibility(View.VISIBLE);
}
});
我收到此错误,
有人可以解释为什么会这样吗?
答案 0 :(得分:1)
试试这个: -
使用此依赖关系使用GlideDrawable
的{{1}}方法和Glide
的{{1}}方法
.using(new FirebaseImageLoader())
FirebaseUi
修改: - 强>
尝试像这样应用监听器。
compile 'com.firebaseui:firebase-ui-storage:0.6.0'
compile 'com.github.bumptech.glide:glide:3.8.0'
答案 1 :(得分:0)
方法之间的顺序错误。
into(profilePictures)
将返回Target<GlideDrawable>
类型的变量,但listener
需要调用DrawableTypeRequest
。在into
和listener
之间切换订单,它应该有效。
答案 2 :(得分:0)
GlideDrawable
已被弃用,请像这样使用侦听器。
Glide.with(mContext)
.load(item.getFriendUserPhotoUrl())
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
fullname.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
imageView.setImageResource(R.drawable.profile_default_photo);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
progressBar.setVisibility(View.GONE);
fullname.setVisibility(View.VISIBLE);
return false;
}
})
.into(holder.thumbnail);