kopia lustrzana https://github.com/ryukoposting/Signal-Android
Stop observing LiveRecipient in contact list when detached.
rodzic
cae5dad5d8
commit
ff633ddd59
|
@ -141,7 +141,7 @@ public class ContactSelectionListAdapter extends CursorRecyclerViewAdapter<ViewH
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unbind(@NonNull GlideRequests glideRequests) {
|
public void unbind(@NonNull GlideRequests glideRequests) {
|
||||||
getView().unbind(glideRequests);
|
getView().unbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -71,6 +71,12 @@ public class ContactSelectionListItem extends ConstraintLayout implements Recipi
|
||||||
ViewUtil.setTextViewGravityStart(this.nameView, getContext());
|
ViewUtil.setTextViewGravityStart(this.nameView, getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
unbind();
|
||||||
|
}
|
||||||
|
|
||||||
public void set(@NonNull GlideRequests glideRequests,
|
public void set(@NonNull GlideRequests glideRequests,
|
||||||
@Nullable RecipientId recipientId,
|
@Nullable RecipientId recipientId,
|
||||||
int type,
|
int type,
|
||||||
|
@ -92,6 +98,9 @@ public class ContactSelectionListItem extends ConstraintLayout implements Recipi
|
||||||
this.recipient = null;
|
this.recipient = null;
|
||||||
this.contactPhotoImage.setAvatar(glideRequests, null, false);
|
this.contactPhotoImage.setAvatar(glideRequests, null, false);
|
||||||
} else if (recipientId != null) {
|
} else if (recipientId != null) {
|
||||||
|
if (this.recipient != null) {
|
||||||
|
this.recipient.removeForeverObserver(this);
|
||||||
|
}
|
||||||
this.recipient = Recipient.live(recipientId);
|
this.recipient = Recipient.live(recipientId);
|
||||||
this.recipient.observeForever(this);
|
this.recipient.observeForever(this);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +159,7 @@ public class ContactSelectionListItem extends ConstraintLayout implements Recipi
|
||||||
this.checkBox.setEnabled(enabled);
|
this.checkBox.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unbind(GlideRequests glideRequests) {
|
public void unbind() {
|
||||||
if (recipient != null) {
|
if (recipient != null) {
|
||||||
recipient.removeForeverObserver(this);
|
recipient.removeForeverObserver(this);
|
||||||
recipient = null;
|
recipient = null;
|
||||||
|
|
Ładowanie…
Reference in New Issue