fix images disappearing when in recyclerviews

Fixes #3142
Closes #3288
// FREEBIE
This commit is contained in:
Jake McGinty 2015-05-30 22:10:40 -07:00 committed by Moxie Marlinspike
parent bd2e984963
commit bb6b86ad59
2 changed files with 5 additions and 5 deletions

View File

@ -166,6 +166,7 @@ public class ConversationItem extends LinearLayout {
}
public void unbind() {
mediaThumbnail.clear();
}
public MessageRecord getMessageRecord() {

View File

@ -53,11 +53,6 @@ public class ThumbnailView extends ForegroundImageView {
super(context, attrs, defStyle);
}
@Override protected void onDetachedFromWindow() {
Glide.clear(this);
super.onDetachedFromWindow();
}
public void setImageResource(@Nullable MasterSecret masterSecret,
long id, long timestamp,
@NonNull ListenableFutureTask<SlideDeck> slideDeckFuture)
@ -97,6 +92,10 @@ public class ThumbnailView extends ForegroundImageView {
this.thumbnailClickListener = listener;
}
public void clear() {
if (isContextValid()) Glide.clear(this);
}
@TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
private boolean isContextValid() {
return !(getContext() instanceof Activity) ||