Translate message details projection to correct coordinate system.
This commit is contained in:
parent
eb6ef3d005
commit
9bcb1bad8e
3 changed files with 13 additions and 29 deletions
|
@ -95,12 +95,15 @@ class RecyclerViewColorizer(private val recyclerView: RecyclerView) {
|
||||||
|
|
||||||
for (i in 0 until parent.childCount) {
|
for (i in 0 until parent.childCount) {
|
||||||
val child = parent.getChildAt(i)
|
val child = parent.getChildAt(i)
|
||||||
if (child != null && child is Colorizable) {
|
if (child != null) {
|
||||||
child.colorizerProjections.forEach {
|
val holder = parent.getChildViewHolder(child)
|
||||||
|
if (holder is Colorizable) {
|
||||||
|
holder.colorizerProjections.forEach {
|
||||||
c.drawPath(it.path, holePunchPaint)
|
c.drawPath(it.path, holePunchPaint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drawShaderMask(c, parent, colors)
|
drawShaderMask(c, parent, colors)
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements GiphyMp4Playable, Colorizable {
|
final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements GiphyMp4Playable, Colorizable {
|
||||||
private final TextView sentDate;
|
private final TextView sentDate;
|
||||||
|
@ -55,7 +56,6 @@ final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements G
|
||||||
private final ViewStub updateStub;
|
private final ViewStub updateStub;
|
||||||
private final ViewStub sentStub;
|
private final ViewStub sentStub;
|
||||||
private final ViewStub receivedStub;
|
private final ViewStub receivedStub;
|
||||||
private final ClipProjectionDrawable clipProjectionDrawable;
|
|
||||||
private final Colorizer colorizer;
|
private final Colorizer colorizer;
|
||||||
|
|
||||||
private GlideRequests glideRequests;
|
private GlideRequests glideRequests;
|
||||||
|
@ -77,9 +77,6 @@ final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements G
|
||||||
updateStub = itemView.findViewById(R.id.message_details_header_message_view_update);
|
updateStub = itemView.findViewById(R.id.message_details_header_message_view_update);
|
||||||
sentStub = itemView.findViewById(R.id.message_details_header_message_view_sent_multimedia);
|
sentStub = itemView.findViewById(R.id.message_details_header_message_view_sent_multimedia);
|
||||||
receivedStub = itemView.findViewById(R.id.message_details_header_message_view_received_multimedia);
|
receivedStub = itemView.findViewById(R.id.message_details_header_message_view_received_multimedia);
|
||||||
|
|
||||||
clipProjectionDrawable = new ClipProjectionDrawable(itemView.getBackground());
|
|
||||||
itemView.setBackground(clipProjectionDrawable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind(@NonNull LifecycleOwner lifecycleOwner, @Nullable ConversationMessage conversationMessage, boolean running) {
|
void bind(@NonNull LifecycleOwner lifecycleOwner, @Nullable ConversationMessage conversationMessage, boolean running) {
|
||||||
|
@ -225,13 +222,11 @@ final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements G
|
||||||
@Override
|
@Override
|
||||||
public void showProjectionArea() {
|
public void showProjectionArea() {
|
||||||
conversationItem.showProjectionArea();
|
conversationItem.showProjectionArea();
|
||||||
updateProjections();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hideProjectionArea() {
|
public void hideProjectionArea() {
|
||||||
conversationItem.hideProjectionArea();
|
conversationItem.hideProjectionArea();
|
||||||
updateProjections();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -256,23 +251,10 @@ final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements G
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull List<Projection> getColorizerProjections() {
|
public @NonNull List<Projection> getColorizerProjections() {
|
||||||
List<Projection> projections = conversationItem.getColorizerProjections();
|
return conversationItem.getColorizerProjections()
|
||||||
updateProjections();
|
.stream()
|
||||||
return projections;
|
.map(p -> Projection.translateFromRootToDescendantCoords(p, (ViewGroup) itemView.getParent()))
|
||||||
}
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
private void updateProjections() {
|
|
||||||
Set<Projection> projections = new HashSet<>();
|
|
||||||
|
|
||||||
if (canPlayContent()) {
|
|
||||||
projections.add(conversationItem.getGiphyMp4PlayableProjection((ViewGroup) itemView));
|
|
||||||
}
|
|
||||||
|
|
||||||
projections.addAll(Stream.of(conversationItem.getColorizerProjections())
|
|
||||||
.map(p -> Projection.translateFromRootToDescendantCoords(p, itemView))
|
|
||||||
.toList());
|
|
||||||
|
|
||||||
clipProjectionDrawable.setProjections(projections);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ExpiresUpdater implements Runnable {
|
private class ExpiresUpdater implements Runnable {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/group_media_card"
|
android:id="@+id/group_media_card"
|
||||||
style="@style/Widget.Signal.CardView.PreferenceRow"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
@ -135,4 +134,4 @@
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@color/signal_inverse_transparent_05" />
|
android:background="@color/signal_inverse_transparent_05" />
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</FrameLayout>
|
||||||
|
|
Loading…
Add table
Reference in a new issue