mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 02:39:55 +01:00
Add toast when long pressing camera button and video is not supported.
This commit is contained in:
committed by
Cody Henthorne
parent
3090a8521c
commit
0b21481539
@@ -337,6 +337,11 @@ public class Camera1Fragment extends LoggingFragment implements CameraFragment,
|
||||
onCaptureClicked();
|
||||
});
|
||||
|
||||
captureButton.setOnLongClickListener(unused -> {
|
||||
CameraFragment.toastVideoRecordingNotAvailable(requireContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
orderEnforcer.run(Stage.CAMERA_PROPERTIES_AVAILABLE, () -> {
|
||||
if (properties.getCameraCount() > 1) {
|
||||
flipButton.setVisibility(properties.getCameraCount() > 1 ? View.VISIBLE : View.GONE);
|
||||
|
||||
@@ -186,11 +186,6 @@ public class CameraButtonView extends View {
|
||||
canvas.drawArc(progressRect, 270f, 360f * progressPercent, false, progressPaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnLongClickListener(@Nullable OnLongClickListener listener) {
|
||||
throw new IllegalStateException("Use setVideoCaptureListener instead");
|
||||
}
|
||||
|
||||
public void setVideoCaptureListener(@Nullable VideoCaptureListener videoCaptureListener) {
|
||||
if (isRecordingVideo) throw new IllegalStateException("Cannot set video capture listener while recording");
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package org.thoughtcrime.securesms.mediasend;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.camera.view.video.ExperimentalVideo;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.mediasend.camerax.CameraXUtil;
|
||||
import org.thoughtcrime.securesms.mms.MediaConstraints;
|
||||
|
||||
@@ -47,6 +50,11 @@ public interface CameraFragment {
|
||||
}
|
||||
}
|
||||
|
||||
static void toastVideoRecordingNotAvailable(@NonNull Context context) {
|
||||
Toast.makeText(context, R.string.CameraFragment__video_recording_is_not_supported_on_your_device, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
|
||||
void presentHud(int selectedMediaCount);
|
||||
void fadeOutControls(@NonNull Runnable onEndAction);
|
||||
void fadeInControls();
|
||||
|
||||
@@ -398,6 +398,11 @@ public class CameraXFragment extends LoggingFragment implements CameraFragment {
|
||||
Log.w(TAG, "Video capture is not supported on this device.", e);
|
||||
}
|
||||
} else {
|
||||
captureButton.setOnLongClickListener(unused -> {
|
||||
CameraFragment.toastVideoRecordingNotAvailable(requireContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
Log.i(TAG, "Video capture not supported. " +
|
||||
"API: " + Build.VERSION.SDK_INT + ", " +
|
||||
"MFD: " + MemoryFileDescriptor.supported() + ", " +
|
||||
|
||||
Reference in New Issue
Block a user