mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-22 02:36:55 +00:00
Fix gif display when list is changed and view holders are not reused.
This commit is contained in:
@@ -302,8 +302,6 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||
|
||||
typingView = (ConversationTypingView) inflater.inflate(R.layout.conversation_typing_view, container, false);
|
||||
|
||||
giphyMp4ProjectionRecycler = initializeGiphyMp4();
|
||||
|
||||
new ConversationItemSwipeCallback(
|
||||
conversationMessage -> actionMode == null &&
|
||||
MenuState.canReplyToMessage(recipient.get(),
|
||||
@@ -316,6 +314,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||
).attachToRecyclerView(list);
|
||||
|
||||
setupListLayoutListeners();
|
||||
giphyMp4ProjectionRecycler = initializeGiphyMp4();
|
||||
|
||||
this.groupViewModel = ViewModelProviders.of(requireActivity(), new ConversationGroupViewModel.Factory()).get(ConversationGroupViewModel.class);
|
||||
this.messageCountsViewModel = ViewModelProviders.of(requireActivity()).get(MessageCountsViewModel.class);
|
||||
|
||||
@@ -61,6 +61,9 @@ public final class GiphyMp4ProjectionPlayerHolder implements Player.Listener {
|
||||
|
||||
public void setOnPlaybackReady(@Nullable Runnable onPlaybackReady) {
|
||||
this.onPlaybackReady = onPlaybackReady;
|
||||
if (onPlaybackReady != null && player.getPlaybackState() == Player.STATE_READY) {
|
||||
onPlaybackReady.run();
|
||||
}
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
|
||||
@@ -95,7 +95,7 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
|
||||
Projection projection = giphyMp4Playable.getGiphyMp4PlayableProjection(recyclerView);
|
||||
|
||||
holder.getContainer().setX(projection.getX());
|
||||
holder.getContainer().setY(projection.getY());
|
||||
holder.getContainer().setY(projection.getY() + recyclerView.getTranslationY());
|
||||
|
||||
ViewGroup.LayoutParams params = holder.getContainer().getLayoutParams();
|
||||
if (params.width != projection.getWidth() || params.height != projection.getHeight()) {
|
||||
@@ -115,6 +115,8 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
|
||||
holder.show();
|
||||
holder.setOnPlaybackReady(giphyMp4Playable::hideProjectionArea);
|
||||
holder.playContent(giphyMp4Playable.getMediaItem(), giphyMp4Playable.getPlaybackPolicyEnforcer());
|
||||
} else {
|
||||
holder.setOnPlaybackReady(giphyMp4Playable::hideProjectionArea);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,10 @@ public final class GiphyMp4VideoPlayer extends FrameLayout implements DefaultLif
|
||||
this.exoPlayer = exoPlayer;
|
||||
}
|
||||
|
||||
int getPlaybackState() {
|
||||
return exoPlayer.getPlaybackState();
|
||||
}
|
||||
|
||||
void setVideoItem(@NonNull MediaItem mediaItem) {
|
||||
exoPlayer.setMediaItem(mediaItem);
|
||||
exoPlayer.prepare();
|
||||
|
||||
Reference in New Issue
Block a user