2017-12-14 30 views
0
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); 
     } 
    }); 

나는이 오류를 받고 있어요?글라이드 - 확인할 수 없습니다 방법 리스너 왜 이런 일 <p><img src="https://i.stack.imgur.com/N1Mfb.png" alt="I'm getting this error:"></p> <p></p> 누군가가 설명 할 수

+0

후 당신의 글라이드 의존성 – ADM

+0

컴파일 'com.github.bumptech.glide : 글라이드 : 3.8.0'글라이드 : 4.4 최신 버전으로 수토 - MinyukusTamas 업데이트 @ –

+0

는'com.github.bumptech.glide를 컴파일합니다. 0'으로 변경하고'GlideDrawable'을'Drawable'로 변경합니다. 더 이상 'GlideDrawable'가 없습니다. –

답변

0

이 시도 : -

사용이 의존성을 GlideGlideDrawable 방법 FirebaseUi

compile 'com.firebaseui:firebase-ui-storage:0.6.0' 
compile 'com.github.bumptech.glide:glide:3.8.0' 

Glide.with(MainActivity.this) 
        .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; 
         } 
        }); 

편집의 .using(new FirebaseImageLoader()) 방법 사용 : -

,536을

이와 같이 청취자를 적용하도록하십시오.

Glide.with(MainActivity.this) 
       .using(new FirebaseImageLoader()) 
       .load(profilePicture) 
       .signature(new StringSignature(String.valueOf(System.currentTimeMillis()))) 
       .into(new GlideDrawableImageViewTarget(profilePictures) { 
        @Override 
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) { 
         super.onResourceReady(resource, animation); 
         //try to hide here 
        } 

        @Override 
        public void onLoadFailed(Exception e, Drawable errorDrawable) { 
         super.onLoadFailed(e, errorDrawable); 
         //try to hide here 
        } 
       }); 
+0

문제는 내가 잘못 주문한 것입니다. 'into'와'listener' 메소드와 매개 변수 타입 ('URL'을'StorageReference')으로 바꿔야 만 했었습니다. 그러나 이제 이미지가로드되었거나로드되지 않았더라도 함수를 호출하지 않습니다. –

+0

@ Suto-MinyukusTamas 그래서 ** 당신의 에러 ** 메소드 리스너 **를 해결할 수없고'.using()'가 해결되었지만 효과가 없다고 말하는 겁니까? –

+0

예, onException 및 onResourceReady는 호출되지 않습니다. 이미지가로드 되어도 상관 없습니다. –

0

방법 사이에 순서가 잘못되었습니다. into(profilePictures)Target<GlideDrawable> 유형의 변수를 반환하지만 listenerDrawableTypeRequest에 의해 호출되어야합니다. intolistener 사이에서 주문을 전환하면 제대로 작동합니다.

+0

글쎄, 오류가 발생하여 매개 변수 유형 ('URL'을'StorageReference')으로 변경해야했다. 그러나 이미지가로드되었거나로드되지 않은 경우에도 아무 함수도 호출하지 않습니다. –

+0

호출 여부를 어떻게 확인합니까? –

+0

이미지가로드되고 토스트로 시도했지만 표시되지 않더라도 progressDialog가 사라지지 않습니다. –