Fix MP4 Gif crash with ConversationUpdateItem

Due to adapter positions changing due to deletes and other such
nonsense, there are cases where update items are all of a sudden in our
playing or notplaying arrays. Checking for playable content before
trying to update positioning information seems to have fixed the issue.
fork-5.53.8
Alex Hart 2021-08-06 16:37:33 -03:00
rodzic 0762a93787
commit 89af85c893
2 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -512,7 +512,7 @@ public class ConversationFragment extends LoggingFragment {
private void onViewHolderPositionTranslated(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) { private void onViewHolderPositionTranslated(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
if (viewHolder instanceof GiphyMp4Playable) { if (viewHolder instanceof GiphyMp4Playable) {
giphyMp4ProjectionRecycler.updateDisplay(recyclerView, (GiphyMp4Playable) viewHolder); giphyMp4ProjectionRecycler.updateVideoDisplayPositionAndSize(recyclerView, (GiphyMp4Playable) viewHolder);
} }
if (colorizer != null) { if (colorizer != null) {

Wyświetl plik

@ -46,14 +46,14 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
} }
for (final GiphyMp4Playable holder : holders) { for (final GiphyMp4Playable holder : holders) {
updateDisplay(recyclerView, holder); updateVideoDisplayPositionAndSize(recyclerView, holder);
} }
} }
public void updateDisplay(@NonNull RecyclerView recyclerView, @NonNull GiphyMp4Playable holder) { public void updateVideoDisplayPositionAndSize(@NonNull RecyclerView recyclerView, @NonNull GiphyMp4Playable holder) {
GiphyMp4ProjectionPlayerHolder playerHolder = getCurrentHolder(holder.getAdapterPosition()); GiphyMp4ProjectionPlayerHolder playerHolder = getCurrentHolder(holder.getAdapterPosition());
if (playerHolder != null) { if (playerHolder != null) {
updateDisplay(recyclerView, playerHolder, holder); updateVideoDisplayPositionAndSize(recyclerView, playerHolder, holder);
} }
} }
@ -84,7 +84,14 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
} }
} }
private void updateDisplay(@NonNull RecyclerView recyclerView, @NonNull GiphyMp4ProjectionPlayerHolder holder, @NonNull GiphyMp4Playable giphyMp4Playable) { private void updateVideoDisplayPositionAndSize(@NonNull RecyclerView recyclerView,
@NonNull GiphyMp4ProjectionPlayerHolder holder,
@NonNull GiphyMp4Playable giphyMp4Playable)
{
if (!giphyMp4Playable.canPlayContent()) {
return;
}
Projection projection = giphyMp4Playable.getGiphyMp4PlayableProjection(recyclerView); Projection projection = giphyMp4Playable.getGiphyMp4PlayableProjection(recyclerView);
holder.getContainer().setX(projection.getX()); holder.getContainer().setX(projection.getX());