use of org.thoughtcrime.securesms.util.Projection in project Signal-Android by WhisperSystems.
the class ConversationItem method getColorizerProjections.
@Override
@NonNull
public ProjectionList getColorizerProjections(@NonNull ViewGroup coordinateRoot) {
colorizerProjections.clear();
if (messageRecord.isOutgoing() && !hasNoBubble(messageRecord) && !messageRecord.isRemoteDelete() && bodyBubbleCorners != null && bodyBubble.getVisibility() == VISIBLE) {
Projection bodyBubbleToRoot = Projection.relativeToParent(coordinateRoot, bodyBubble, bodyBubbleCorners).translateX(bodyBubble.getTranslationX());
Projection videoToBubble = bodyBubble.getVideoPlayerProjection();
float translationX = Util.halfOffsetFromScale(bodyBubble.getWidth(), bodyBubble.getScaleX());
float translationY = Util.halfOffsetFromScale(bodyBubble.getHeight(), bodyBubble.getScaleY());
if (videoToBubble != null) {
Projection videoToRoot = Projection.translateFromDescendantToParentCoords(videoToBubble, bodyBubble, coordinateRoot);
List<Projection> projections = Projection.getCapAndTail(bodyBubbleToRoot, videoToRoot);
if (!projections.isEmpty()) {
projections.get(0).scale(bodyBubble.getScaleX()).translateX(translationX).translateY(translationY);
projections.get(1).scale(bodyBubble.getScaleX()).translateX(translationX).translateY(-translationY);
}
colorizerProjections.addAll(projections);
} else {
colorizerProjections.add(bodyBubbleToRoot.scale(bodyBubble.getScaleX()).translateX(translationX).translateY(translationY));
}
}
if (messageRecord.isOutgoing() && hasNoBubble(messageRecord) && hasWallpaper && bodyBubble.getVisibility() == VISIBLE) {
ConversationItemFooter footer = getActiveFooter(messageRecord);
Projection footerProjection = footer.getProjection(coordinateRoot);
if (footerProjection != null) {
colorizerProjections.add(footerProjection.translateX(bodyBubble.getTranslationX()).scale(bodyBubble.getScaleX()).translateX(Util.halfOffsetFromScale(footer.getWidth(), bodyBubble.getScaleX())).translateY(-Util.halfOffsetFromScale(footer.getHeight(), bodyBubble.getScaleY())));
}
}
if (!messageRecord.isOutgoing() && hasQuote(messageRecord) && quoteView != null && bodyBubble.getVisibility() == VISIBLE) {
bodyBubble.setQuoteViewProjection(quoteView.getProjection(bodyBubble));
float bubbleOffsetFromScale = Util.halfOffsetFromScale(bodyBubble.getHeight(), bodyBubble.getScaleY());
Projection cProj = quoteView.getProjection(coordinateRoot).translateX(bodyBubble.getTranslationX() + this.getTranslationX() + Util.halfOffsetFromScale(quoteView.getWidth(), bodyBubble.getScaleX())).translateY(bubbleOffsetFromScale - quoteView.getY() + (quoteView.getY() * bodyBubble.getScaleY())).scale(bodyBubble.getScaleX());
colorizerProjections.add(cProj);
}
for (int i = 0; i < colorizerProjections.size(); i++) {
colorizerProjections.get(i).translateY(getTranslationY());
}
return colorizerProjections;
}
use of org.thoughtcrime.securesms.util.Projection in project Signal-Android by WhisperSystems.
the class ConversationItem method getProjectionTop.
private static int getProjectionTop(@NonNull View child) {
Projection projection = Projection.relativeToViewRoot(child, null);
int y = (int) projection.getY();
projection.release();
return y;
}
use of org.thoughtcrime.securesms.util.Projection in project Signal-Android by WhisperSystems.
the class GiphyMp4ProjectionRecycler method updateVideoDisplayPositionAndSize.
private void updateVideoDisplayPositionAndSize(@NonNull RecyclerView recyclerView, @NonNull GiphyMp4ProjectionPlayerHolder holder, @NonNull GiphyMp4Playable giphyMp4Playable) {
if (!giphyMp4Playable.canPlayContent()) {
return;
}
Projection projection = giphyMp4Playable.getGiphyMp4PlayableProjection(recyclerView);
holder.getContainer().setX(projection.getX());
holder.getContainer().setY(projection.getY() + recyclerView.getTranslationY());
ViewGroup.LayoutParams params = holder.getContainer().getLayoutParams();
if (params.width != projection.getWidth() || params.height != projection.getHeight()) {
params.width = projection.getWidth();
params.height = projection.getHeight();
holder.getContainer().setLayoutParams(params);
}
holder.setCorners(projection.getCorners());
projection.release();
}
use of org.thoughtcrime.securesms.util.Projection in project Signal-Android by WhisperSystems.
the class ConversationItem method isTouchBelowBoundary.
private boolean isTouchBelowBoundary(@NonNull View child) {
Projection childProjection = Projection.relativeToParent(this, child, null);
float childBoundary = childProjection.getY() + childProjection.getHeight();
return lastYDownRelativeToThis > childBoundary;
}
use of org.thoughtcrime.securesms.util.Projection in project Signal-Android by WhisperSystems.
the class ConversationItem method getProjectionBottom.
private static int getProjectionBottom(@NonNull View child) {
Projection projection = Projection.relativeToViewRoot(child, null);
int bottom = (int) projection.getY() + projection.getHeight();
projection.release();
return bottom;
}
Aggregations