Fix multiple chatcolors issues from beta feedback.

- Fix issue where custom color would come out as black
- Completely remove mask view in favour of using the item decoration.
- Fix issue where video gifs wouldn't "cut through" bubble.
- Fix issue where multiselect shade would only appear if bottom or top item was not visible
This commit is contained in:
Alex Hart
2021-09-29 13:38:34 -03:00
committed by Cody Henthorne
parent 705839068a
commit 7e91132e7e
15 changed files with 153 additions and 337 deletions

View File

@@ -14,6 +14,9 @@ import androidx.recyclerview.widget.RecyclerView;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.components.CornerMask;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
@@ -159,6 +162,42 @@ public final class Projection {
return new Projection(viewBounds.left, viewBounds.top, descendantProjection.width, descendantProjection.height, descendantProjection.corners);
}
public static @NonNull List<Projection> getCapAndTail(@NonNull Projection parentProjection, @NonNull Projection childProjection) {
if (parentProjection.equals(childProjection)) {
return Collections.emptyList();
}
float topX = parentProjection.x;
float topY = parentProjection.y;
int topWidth = parentProjection.getWidth();
int topHeight = (int) (childProjection.y - parentProjection.y);
final Corners topCorners;
Corners parentCorners = parentProjection.getCorners();
if (parentCorners != null) {
topCorners = new Corners(parentCorners.topLeft, parentCorners.topRight, 0f, 0f);
} else {
topCorners = null;
}
float bottomX = parentProjection.x;
float bottomY = parentProjection.y + topHeight + childProjection.getHeight();
int bottomWidth = parentProjection.getWidth();
int bottomHeight = (int) ((parentProjection.y + parentProjection.getHeight()) - bottomY);
final Corners bottomCorners;
if (parentCorners != null) {
bottomCorners = new Corners(0f, 0f, parentCorners.bottomRight, parentCorners.bottomLeft);
} else {
bottomCorners = null;
}
return Arrays.asList(
new Projection(topX, topY, topWidth, topHeight, topCorners),
new Projection(bottomX, bottomY, bottomWidth, bottomHeight, bottomCorners)
);
}
public static final class Corners {
private final float topLeft;
private final float topRight;