From fa0661f58a7ce2031d9d1786e5146a89c63762e1 Mon Sep 17 00:00:00 2001 From: Nicholas Tinsley Date: Thu, 21 Dec 2023 15:16:29 -0500 Subject: [PATCH] Instant video playback for very small video files. --- .../securesms/conversation/ConversationItem.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java index 52600d9d5d..f6808a2041 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java @@ -714,8 +714,6 @@ public final class ConversationItem extends RelativeLayout implements BindableCo bodyBubble.setVideoPlayerProjection(null); bodyBubble.setQuoteViewProjection(null); - playVideoClickListener.cleanup(); - glideRequests = null; } @@ -2517,10 +2515,14 @@ public final class ConversationItem extends RelativeLayout implements BindableCo @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) public void onEventAsync(PartProgressEvent event) { - float progressPercent = ((float) event.progress) / event.total; - final View currentParentView = parentView; final Slide currentActiveSlide = activeSlide; - if (progressPercent >= MINIMUM_DOWNLOADED_THRESHOLD && currentParentView != null && currentActiveSlide != null) { + if (currentActiveSlide == null || !event.attachment.equals(currentActiveSlide.asAttachment())) { + return; + } + + final View currentParentView = parentView; + float progressPercent = ((float) event.progress) / event.total; + if (progressPercent >= MINIMUM_DOWNLOADED_THRESHOLD && currentParentView != null) { cleanup(); launchMediaPreview(currentParentView, currentActiveSlide); }