diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java index b059f8b160..75de0146f1 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java @@ -896,16 +896,20 @@ public final class ConversationItem extends RelativeLayout implements BindableCo } } - private static int getProjectionTop(@NonNull View child) { - Projection projection = Projection.relativeToViewRoot(child, null); - int y = (int) projection.getY(); + /** + * Multiselect boundaries are drawn by an item decoration, so they are relative to the list + * rather than to the view root. + */ + private int getProjectionTop(@NonNull View child) { + Projection projection = Projection.relativeToParent(this, child, null); + int y = (int) projection.getY() + getTop(); projection.release(); return y; } - private static int getProjectionBottom(@NonNull View child) { - Projection projection = Projection.relativeToViewRoot(child, null); - int bottom = (int) projection.getY() + projection.getHeight(); + private int getProjectionBottom(@NonNull View child) { + Projection projection = Projection.relativeToParent(this, child, null); + int bottom = (int) projection.getY() + projection.getHeight() + getTop(); projection.release(); return bottom; } @@ -2653,7 +2657,9 @@ public final class ConversationItem extends RelativeLayout implements BindableCo return null; } - return Projection.relativeToViewRoot(bodyBubble, bodyBubbleCorners) + return Projection.relativeToParent(this, bodyBubble, bodyBubbleCorners) + .translateX(getLeft()) + .translateY(getTop()) .translateX(bodyBubble.getTranslationX()) .translateX(getTranslationX()) .scale(bodyBubble.getScaleX()); diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java index eaeac12634..49871cb5e2 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java @@ -465,8 +465,8 @@ public final class ConversationUpdateItem extends FrameLayout } private int getCollapsedButtonBottom() { - Projection projection = Projection.relativeToViewRoot(collapsedButton, null); - int bottom = (int) projection.getY() + projection.getHeight(); + Projection projection = Projection.relativeToParent(this, collapsedButton, null); + int bottom = (int) projection.getY() + projection.getHeight() + getTop(); projection.release(); return bottom; }