kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix gif display when list is changed and view holders are not reused.
rodzic
82c12c2f6b
commit
ccc96d5bfa
|
@ -302,8 +302,6 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||||
|
|
||||||
typingView = (ConversationTypingView) inflater.inflate(R.layout.conversation_typing_view, container, false);
|
typingView = (ConversationTypingView) inflater.inflate(R.layout.conversation_typing_view, container, false);
|
||||||
|
|
||||||
giphyMp4ProjectionRecycler = initializeGiphyMp4();
|
|
||||||
|
|
||||||
new ConversationItemSwipeCallback(
|
new ConversationItemSwipeCallback(
|
||||||
conversationMessage -> actionMode == null &&
|
conversationMessage -> actionMode == null &&
|
||||||
MenuState.canReplyToMessage(recipient.get(),
|
MenuState.canReplyToMessage(recipient.get(),
|
||||||
|
@ -316,6 +314,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||||
).attachToRecyclerView(list);
|
).attachToRecyclerView(list);
|
||||||
|
|
||||||
setupListLayoutListeners();
|
setupListLayoutListeners();
|
||||||
|
giphyMp4ProjectionRecycler = initializeGiphyMp4();
|
||||||
|
|
||||||
this.groupViewModel = ViewModelProviders.of(requireActivity(), new ConversationGroupViewModel.Factory()).get(ConversationGroupViewModel.class);
|
this.groupViewModel = ViewModelProviders.of(requireActivity(), new ConversationGroupViewModel.Factory()).get(ConversationGroupViewModel.class);
|
||||||
this.messageCountsViewModel = ViewModelProviders.of(requireActivity()).get(MessageCountsViewModel.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) {
|
public void setOnPlaybackReady(@Nullable Runnable onPlaybackReady) {
|
||||||
this.onPlaybackReady = onPlaybackReady;
|
this.onPlaybackReady = onPlaybackReady;
|
||||||
|
if (onPlaybackReady != null && player.getPlaybackState() == Player.STATE_READY) {
|
||||||
|
onPlaybackReady.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hide() {
|
public void hide() {
|
||||||
|
|
|
@ -95,7 +95,7 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
|
||||||
Projection projection = giphyMp4Playable.getGiphyMp4PlayableProjection(recyclerView);
|
Projection projection = giphyMp4Playable.getGiphyMp4PlayableProjection(recyclerView);
|
||||||
|
|
||||||
holder.getContainer().setX(projection.getX());
|
holder.getContainer().setX(projection.getX());
|
||||||
holder.getContainer().setY(projection.getY());
|
holder.getContainer().setY(projection.getY() + recyclerView.getTranslationY());
|
||||||
|
|
||||||
ViewGroup.LayoutParams params = holder.getContainer().getLayoutParams();
|
ViewGroup.LayoutParams params = holder.getContainer().getLayoutParams();
|
||||||
if (params.width != projection.getWidth() || params.height != projection.getHeight()) {
|
if (params.width != projection.getWidth() || params.height != projection.getHeight()) {
|
||||||
|
@ -115,6 +115,8 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
|
||||||
holder.show();
|
holder.show();
|
||||||
holder.setOnPlaybackReady(giphyMp4Playable::hideProjectionArea);
|
holder.setOnPlaybackReady(giphyMp4Playable::hideProjectionArea);
|
||||||
holder.playContent(giphyMp4Playable.getMediaItem(), giphyMp4Playable.getPlaybackPolicyEnforcer());
|
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;
|
this.exoPlayer = exoPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getPlaybackState() {
|
||||||
|
return exoPlayer.getPlaybackState();
|
||||||
|
}
|
||||||
|
|
||||||
void setVideoItem(@NonNull MediaItem mediaItem) {
|
void setVideoItem(@NonNull MediaItem mediaItem) {
|
||||||
exoPlayer.setMediaItem(mediaItem);
|
exoPlayer.setMediaItem(mediaItem);
|
||||||
exoPlayer.prepare();
|
exoPlayer.prepare();
|
||||||
|
|
Ładowanie…
Reference in New Issue