mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-25 05:27:42 +00:00
Hide and show video players as content changes.
This commit is contained in:
@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.giph.mp4;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
@@ -63,6 +64,14 @@ public final class GiphyMp4ProjectionPlayerHolder implements Player.EventListene
|
||||
this.onPlaybackReady = onPlaybackReady;
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
container.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void show() {
|
||||
container.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
|
||||
if (playbackState == Player.STATE_READY) {
|
||||
|
||||
@@ -77,6 +77,10 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
|
||||
for (final Integer key : markedForDeletion) {
|
||||
playing.remove(key);
|
||||
}
|
||||
|
||||
for (int i = 0; i < notPlaying.size(); i++) {
|
||||
notPlaying.valueAt(i).hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDisplay(@NonNull RecyclerView recyclerView, @NonNull GiphyMp4ProjectionPlayerHolder holder, @NonNull GiphyMp4Playable giphyMp4Playable) {
|
||||
@@ -100,6 +104,7 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
|
||||
holder.setOnPlaybackReady(null);
|
||||
giphyMp4Playable.showProjectionArea();
|
||||
|
||||
holder.show();
|
||||
holder.setOnPlaybackReady(giphyMp4Playable::hideProjectionArea);
|
||||
holder.playContent(giphyMp4Playable.getMediaSource(), giphyMp4Playable.getPlaybackPolicyEnforcer());
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
style="@style/Signal.Text.Body"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:windowBackground"
|
||||
android:gravity="center"
|
||||
android:text="@string/giphy_fragment__nothing_found"
|
||||
android:visibility="gone" />
|
||||
|
||||
Reference in New Issue
Block a user