Fix issue where a document with text would cause a crash and not be multiselectable.

fork-5.53.8
Alex Hart 2021-08-16 11:36:03 -03:00
rodzic 8e94ced7b6
commit 7480ea66ec
1 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -533,8 +533,17 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
} else {
return top;
}
} else if (hasDocument(messageRecord)) {
Projection documentProjection = Projection.relativeToParent(this, documentViewStub.get(), null);
float documentBoundary = documentProjection.getY() + documentProjection.getHeight();
if (lastYDownRelativeToThis > documentBoundary) {
return bottom;
} else {
return top;
}
} else {
throw new IllegalStateException("Found a situation where we have something other than a thumbnail.");
throw new IllegalStateException("Found a situation where we have something other than a thumbnail or a document.");
}
}
@ -543,9 +552,15 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
if (multiselectPart instanceof MultiselectPart.Attachments && hasThumbnail(messageRecord)) {
Projection projection = Projection.relativeToViewRoot(mediaThumbnailStub.require(), null);
return (int) projection.getY();
} if (multiselectPart instanceof MultiselectPart.Attachments && hasDocument(messageRecord)) {
Projection projection = Projection.relativeToViewRoot(documentViewStub.get(), null);
return (int) projection.getY();
} else if (multiselectPart instanceof MultiselectPart.Text && hasThumbnail(messageRecord)) {
Projection projection = Projection.relativeToViewRoot(mediaThumbnailStub.require(), null);
return (int) projection.getY() + projection.getHeight();
} else if (multiselectPart instanceof MultiselectPart.Text && hasDocument(messageRecord)) {
Projection projection = Projection.relativeToViewRoot(documentViewStub.get(), null);
return (int) projection.getY() + projection.getHeight();
} else if (hasNoBubble(messageRecord)) {
return getTop();
} else {
@ -559,6 +574,9 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
if (multiselectPart instanceof MultiselectPart.Attachments && hasThumbnail(messageRecord)) {
Projection projection = Projection.relativeToViewRoot(mediaThumbnailStub.require(), null);
return (int) projection.getY() + projection.getHeight();
} else if (multiselectPart instanceof MultiselectPart.Attachments && hasDocument(messageRecord)) {
Projection projection = Projection.relativeToViewRoot(documentViewStub.get(), null);
return (int) projection.getY() + projection.getHeight();
} else if (hasNoBubble(messageRecord)) {
return getBottom();
} else {