Translate message details projection to correct coordinate system.

fork-5.53.8
Alex Hart 2021-09-30 13:00:06 -03:00 zatwierdzone przez GitHub
rodzic eb6ef3d005
commit 9bcb1bad8e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 13 dodań i 29 usunięć

Wyświetl plik

@ -95,9 +95,12 @@ class RecyclerViewColorizer(private val recyclerView: RecyclerView) {
for (i in 0 until parent.childCount) {
val child = parent.getChildAt(i)
if (child != null && child is Colorizable) {
child.colorizerProjections.forEach {
c.drawPath(it.path, holePunchPaint)
if (child != null) {
val holder = parent.getChildViewHolder(child)
if (holder is Colorizable) {
holder.colorizerProjections.forEach {
c.drawPath(it.path, holePunchPaint)
}
}
}
}

Wyświetl plik

@ -43,6 +43,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Collectors;
final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements GiphyMp4Playable, Colorizable {
private final TextView sentDate;
@ -55,7 +56,6 @@ final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements G
private final ViewStub updateStub;
private final ViewStub sentStub;
private final ViewStub receivedStub;
private final ClipProjectionDrawable clipProjectionDrawable;
private final Colorizer colorizer;
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);
sentStub = itemView.findViewById(R.id.message_details_header_message_view_sent_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) {
@ -225,13 +222,11 @@ final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements G
@Override
public void showProjectionArea() {
conversationItem.showProjectionArea();
updateProjections();
}
@Override
public void hideProjectionArea() {
conversationItem.hideProjectionArea();
updateProjections();
}
@Override
@ -256,23 +251,10 @@ final class MessageHeaderViewHolder extends RecyclerView.ViewHolder implements G
@Override
public @NonNull List<Projection> getColorizerProjections() {
List<Projection> projections = conversationItem.getColorizerProjections();
updateProjections();
return projections;
}
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);
return conversationItem.getColorizerProjections()
.stream()
.map(p -> Projection.translateFromRootToDescendantCoords(p, (ViewGroup) itemView.getParent()))
.collect(Collectors.toList());
}
private class ExpiresUpdater implements Runnable {

Wyświetl plik

@ -1,9 +1,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:tools="http://schemas.android.com/tools"
android:id="@+id/group_media_card"
style="@style/Widget.Signal.CardView.PreferenceRow"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -135,4 +134,4 @@
android:layout_gravity="bottom"
android:background="@color/signal_inverse_transparent_05" />
</androidx.cardview.widget.CardView>
</FrameLayout>