mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Fix gif playback in CFv2.
This commit is contained in:
@@ -1,92 +0,0 @@
|
||||
package org.thoughtcrime.securesms.conversation;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Drawable which lets you punch a hole through another drawable.
|
||||
*
|
||||
* TODO: Remove in favor of ClipProjectionDrawable
|
||||
*/
|
||||
public final class MaskDrawable extends Drawable {
|
||||
|
||||
private final RectF bounds = new RectF();
|
||||
private final Path clipPath = new Path();
|
||||
|
||||
private Rect clipRect;
|
||||
private float[] clipPathRadii;
|
||||
|
||||
private final Drawable wrapped;
|
||||
|
||||
public MaskDrawable(@NonNull Drawable wrapped) {
|
||||
this.wrapped = wrapped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(@NonNull Canvas canvas) {
|
||||
if (clipRect == null) {
|
||||
wrapped.draw(canvas);
|
||||
return;
|
||||
}
|
||||
|
||||
canvas.save();
|
||||
|
||||
if (clipPathRadii != null) {
|
||||
clipPath.reset();
|
||||
bounds.set(clipRect);
|
||||
clipPath.addRoundRect(bounds, clipPathRadii, Path.Direction.CW);
|
||||
canvas.clipPath(clipPath, Region.Op.DIFFERENCE);
|
||||
} else {
|
||||
canvas.clipRect(clipRect, Region.Op.DIFFERENCE);
|
||||
}
|
||||
|
||||
wrapped.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
wrapped.setAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(@Nullable ColorFilter colorFilter) {
|
||||
wrapped.setColorFilter(colorFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return wrapped.getOpacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds(int left, int top, int right, int bottom) {
|
||||
super.setBounds(left, top, right, bottom);
|
||||
wrapped.setBounds(left, top, right, bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPadding(@NonNull Rect padding) {
|
||||
return wrapped.getPadding(padding);
|
||||
}
|
||||
|
||||
public void setMask(@Nullable Rect mask) {
|
||||
this.clipRect = new Rect(mask);
|
||||
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
public void setCorners(@Nullable float[] clipPathRadii) {
|
||||
this.clipPathRadii = clipPathRadii;
|
||||
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ class ConversationAdapterV2(
|
||||
*/
|
||||
fun pulseAtPosition(position: Int) {
|
||||
if (position >= 0 && position < itemCount) {
|
||||
// todo [cody] adjust for typing indicator
|
||||
// TODO [cfv2] adjust for typing indicator
|
||||
val correctedPosition = position
|
||||
|
||||
recordToPulse = getConversationMessage(correctedPosition)
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
android:layout_height="match_parent"
|
||||
app:animateKeyboardChanges="true">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/conversation_video_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/conversation_item_recycler"
|
||||
app:layout_constraintEnd_toEndOf="@+id/conversation_item_recycler"
|
||||
app:layout_constraintStart_toStartOf="@+id/conversation_item_recycler"
|
||||
app:layout_constraintTop_toTopOf="@+id/conversation_item_recycler" />
|
||||
|
||||
<include layout="@layout/system_ui_guidelines" />
|
||||
|
||||
<ImageView
|
||||
@@ -35,6 +26,15 @@
|
||||
tools:alpha="0.2f"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/conversation_video_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/conversation_item_recycler"
|
||||
app:layout_constraintEnd_toEndOf="@+id/conversation_item_recycler"
|
||||
app:layout_constraintStart_toStartOf="@+id/conversation_item_recycler"
|
||||
app:layout_constraintTop_toTopOf="@+id/conversation_item_recycler" />
|
||||
|
||||
<org.thoughtcrime.securesms.conversation.mutiselect.MultiselectRecyclerView
|
||||
android:id="@+id/conversation_item_recycler"
|
||||
android:layout_width="0dp"
|
||||
|
||||
Reference in New Issue
Block a user