mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-28 09:38:14 +03:00
TakePhotoActivity: Use full field of view
Some devices have a digital video stabilization mode that uses a smaller field of view within the full set of sensor data, and moves the selected subset around like on rubber bands in order to reduce shaking in video captures. Most devices default this mode to OFF, but some, like Pixel 6 Pro, default this mode to ON, which causes image and video captures to have a reduced field of view. This change will have no effect on most devices, but will increase field of view to full on those devices that do not by default. Reference: https://issuetracker.google.com/issues/230013960 Signed-off-by: Adam Serbinski <adam@serbinski.com>
This commit is contained in:
parent
b53e0a8029
commit
5362510d18
1 changed files with 12 additions and 3 deletions
|
@ -26,6 +26,8 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.hardware.camera2.CameraMetadata;
|
||||||
|
import android.hardware.camera2.CaptureRequest;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
@ -54,6 +56,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
|
import androidx.camera.camera2.interop.Camera2Interop;
|
||||||
import androidx.camera.core.AspectRatio;
|
import androidx.camera.core.AspectRatio;
|
||||||
import androidx.camera.core.Camera;
|
import androidx.camera.core.Camera;
|
||||||
import androidx.camera.core.ImageCapture;
|
import androidx.camera.core.ImageCapture;
|
||||||
|
@ -357,9 +360,15 @@ public class TakePhotoActivity extends AppCompatActivity {
|
||||||
return rotate;
|
return rotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Preview getPreview(Boolean crop) {
|
private Preview getPreview(boolean crop) {
|
||||||
Preview preview = new Preview.Builder()
|
Preview.Builder previewBuilder = new Preview.Builder()
|
||||||
.setTargetAspectRatio(crop ? AspectRatio.RATIO_16_9 : AspectRatio.RATIO_4_3).build();
|
.setTargetAspectRatio(crop ? AspectRatio.RATIO_16_9 : AspectRatio.RATIO_4_3);
|
||||||
|
new Camera2Interop.Extender<>(previewBuilder)
|
||||||
|
.setCaptureRequestOption(CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE,
|
||||||
|
CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_OFF
|
||||||
|
);
|
||||||
|
|
||||||
|
Preview preview = previewBuilder.build();
|
||||||
preview.setSurfaceProvider(binding.preview.getSurfaceProvider());
|
preview.setSurfaceProvider(binding.preview.getSurfaceProvider());
|
||||||
|
|
||||||
return preview;
|
return preview;
|
||||||
|
|
Loading…
Reference in a new issue