mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Use context menu when selecting a message in chat.
This commit is contained in:
committed by
Cody Henthorne
parent
d254d24d77
commit
e4d43ade93
@@ -51,4 +51,10 @@ public interface GiphyMp4Playable {
|
||||
* Specifies whether the content can start playing.
|
||||
*/
|
||||
boolean canPlayContent();
|
||||
|
||||
/**
|
||||
* Specifies whether the projection from {@link #getGiphyMp4PlayableProjection(ViewGroup)} should
|
||||
* be used to project into a view.
|
||||
*/
|
||||
boolean shouldProjectContent();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.thoughtcrime.securesms.giph.mp4;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -98,10 +99,18 @@ public final class GiphyMp4ProjectionPlayerHolder implements Player.Listener, De
|
||||
container.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
player.pause();
|
||||
}
|
||||
|
||||
public void show() {
|
||||
container.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
player.play();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
if (playbackState == Player.STATE_READY) {
|
||||
@@ -177,4 +186,8 @@ public final class GiphyMp4ProjectionPlayerHolder implements Player.Listener, De
|
||||
public void setCorners(@Nullable Projection.Corners corners) {
|
||||
player.setCorners(corners);
|
||||
}
|
||||
|
||||
public @Nullable Bitmap getBitmap() {
|
||||
return player.getBitmap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public final class GiphyMp4ProjectionRecycler implements GiphyMp4PlaybackControl
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable GiphyMp4ProjectionPlayerHolder getCurrentHolder(int adapterPosition) {
|
||||
public @Nullable GiphyMp4ProjectionPlayerHolder getCurrentHolder(int adapterPosition) {
|
||||
if (playing.get(adapterPosition) != null) {
|
||||
return playing.get(adapterPosition);
|
||||
} else if (notPlaying.get(adapterPosition) != null) {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package org.thoughtcrime.securesms.giph.mp4;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.TextureView;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -103,6 +106,12 @@ public final class GiphyMp4VideoPlayer extends FrameLayout implements DefaultLif
|
||||
}
|
||||
}
|
||||
|
||||
void pause() {
|
||||
if (exoPlayer != null) {
|
||||
exoPlayer.pause();
|
||||
}
|
||||
}
|
||||
|
||||
void stop() {
|
||||
if (exoPlayer != null) {
|
||||
exoPlayer.stop();
|
||||
@@ -122,4 +131,13 @@ public final class GiphyMp4VideoPlayer extends FrameLayout implements DefaultLif
|
||||
void setResizeMode(@AspectRatioFrameLayout.ResizeMode int resizeMode) {
|
||||
exoView.setResizeMode(resizeMode);
|
||||
}
|
||||
|
||||
@Nullable Bitmap getBitmap() {
|
||||
final View view = exoView.getVideoSurfaceView();
|
||||
if (view instanceof TextureView) {
|
||||
return ((TextureView) view).getBitmap();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,11 @@ final class GiphyMp4ViewHolder extends MappingViewHolder<GiphyImage> implements
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProjectContent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void loadPlaceholderImage(@NonNull GiphyImage giphyImage) {
|
||||
GlideApp.with(itemView)
|
||||
.load(new ChunkedImageUrl(giphyImage.getStillUrl()))
|
||||
|
||||
Reference in New Issue
Block a user