mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Fix color offset on devices with notches.
This commit is contained in:
committed by
Cody Henthorne
parent
a385cb0b68
commit
52cfb57d36
@@ -691,8 +691,8 @@ public class ConversationAdapter
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<Projection> getColorizerProjections() {
|
||||
return getBindable().getColorizerProjections();
|
||||
public @NonNull List<Projection> getColorizerProjections(@NonNull ViewGroup coordinateRoot) {
|
||||
return getBindable().getColorizerProjections(coordinateRoot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1715,7 +1715,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<Projection> getColorizerProjections() {
|
||||
public @NonNull List<Projection> getColorizerProjections(@NonNull ViewGroup coordinateRoot) {
|
||||
List<Projection> projections = new LinkedList<>();
|
||||
|
||||
if (messageRecord.isOutgoing() &&
|
||||
@@ -1723,10 +1723,10 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
!messageRecord.isRemoteDelete() &&
|
||||
bodyBubbleCorners != null)
|
||||
{
|
||||
Projection bodyBubbleToRoot = Projection.relativeToViewRoot(bodyBubble, bodyBubbleCorners).translateX(bodyBubble.getTranslationX());
|
||||
Projection bodyBubbleToRoot = Projection.relativeToParent(coordinateRoot, bodyBubble, bodyBubbleCorners).translateX(bodyBubble.getTranslationX());
|
||||
Projection videoToBubble = bodyBubble.getVideoPlayerProjection();
|
||||
if (videoToBubble != null) {
|
||||
Projection videoToRoot = Projection.translateFromDescendantToParentCoords(videoToBubble, bodyBubble, (ViewGroup) getRootView());
|
||||
Projection videoToRoot = Projection.translateFromDescendantToParentCoords(videoToBubble, bodyBubble, coordinateRoot);
|
||||
projections.addAll(Projection.getCapAndTail(bodyBubbleToRoot, videoToRoot));
|
||||
} else {
|
||||
projections.add(bodyBubbleToRoot);
|
||||
@@ -1737,7 +1737,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
hasNoBubble(messageRecord) &&
|
||||
hasWallpaper)
|
||||
{
|
||||
Projection footerProjection = getActiveFooter(messageRecord).getProjection();
|
||||
Projection footerProjection = getActiveFooter(messageRecord).getProjection(coordinateRoot);
|
||||
if (footerProjection != null) {
|
||||
projections.add(footerProjection.translateX(bodyBubble.getTranslationX()));
|
||||
}
|
||||
@@ -1748,7 +1748,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
quoteView != null)
|
||||
{
|
||||
bodyBubble.setQuoteViewProjection(quoteView.getProjection(bodyBubble));
|
||||
projections.add(quoteView.getProjection((ViewGroup) getRootView()).translateX(bodyBubble.getTranslationX() + this.getTranslationX()));
|
||||
projections.add(quoteView.getProjection(coordinateRoot).translateX(bodyBubble.getTranslationX() + this.getTranslationX()));
|
||||
}
|
||||
|
||||
return projections;
|
||||
|
||||
@@ -221,7 +221,7 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<Projection> getColorizerProjections() {
|
||||
public @NonNull List<Projection> getColorizerProjections(@NonNull ViewGroup coordinateRoot) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.thoughtcrime.securesms.conversation.colors
|
||||
|
||||
import android.view.ViewGroup
|
||||
import org.thoughtcrime.securesms.util.Projection
|
||||
|
||||
/**
|
||||
@@ -7,5 +8,5 @@ import org.thoughtcrime.securesms.util.Projection
|
||||
* generating its own projection.
|
||||
*/
|
||||
interface Colorizable {
|
||||
val colorizerProjections: List<Projection>
|
||||
fun getColorizerProjections(coordinateRoot: ViewGroup): List<Projection>
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class RecyclerViewColorizer(private val recyclerView: RecyclerView) {
|
||||
if (child != null) {
|
||||
val holder = parent.getChildViewHolder(child)
|
||||
if (holder is Colorizable) {
|
||||
holder.colorizerProjections.forEach {
|
||||
holder.getColorizerProjections(parent).forEach {
|
||||
c.drawPath(it.path, holePunchPaint)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class MultiselectItemDecoration(
|
||||
|
||||
val parts: MultiselectCollection = child.conversationMessage.multiselectCollection
|
||||
|
||||
val projections: List<Projection> = child.colorizerProjections + if (child.canPlayContent()) listOf(child.getGiphyMp4PlayableProjection(child.rootView as ViewGroup)) else emptyList()
|
||||
val projections: List<Projection> = child.getColorizerProjections(parent) + if (child.canPlayContent()) listOf(child.getGiphyMp4PlayableProjection(parent)) else emptyList()
|
||||
path.reset()
|
||||
projections.forEach { it.applyToPath(path) }
|
||||
|
||||
@@ -307,7 +307,7 @@ class MultiselectItemDecoration(
|
||||
parent.forEach { child ->
|
||||
if (child is Multiselectable && child.conversationMessage == inFocus.conversationMessage) {
|
||||
path.addRect(child.left.toFloat(), child.top.toFloat(), child.right.toFloat(), child.bottom.toFloat(), Path.Direction.CW)
|
||||
child.colorizerProjections.forEach {
|
||||
child.getColorizerProjections(parent).forEach {
|
||||
path.op(it.path, Path.Op.DIFFERENCE)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user