mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-05-21 17:34:15 +02:00
focus before taking a photo
This commit is contained in:
parent
4fdfa9b157
commit
5265edf5fe
@ -241,7 +241,7 @@ public class MainActivity extends AppCompatActivity implements SensorEventListen
|
|||||||
|
|
||||||
private void handleShutter() {
|
private void handleShutter() {
|
||||||
if (isInPhotoMode) {
|
if (isInPhotoMode) {
|
||||||
preview.takePicture();
|
preview.tryTakePicture();
|
||||||
} else {
|
} else {
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
final boolean isRecording = preview.toggleRecording();
|
final boolean isRecording = preview.toggleRecording();
|
||||||
|
@ -193,7 +193,11 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void takePicture() {
|
public void tryTakePicture() {
|
||||||
|
focusArea(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void takePicture() {
|
||||||
if (canTakePicture) {
|
if (canTakePicture) {
|
||||||
if (isFlashEnabled) {
|
if (isFlashEnabled) {
|
||||||
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
|
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
|
||||||
@ -296,7 +300,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O
|
|||||||
return rotation % 360;
|
return rotation % 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void focusArea() {
|
private void focusArea(final boolean takePictureAfter) {
|
||||||
if (camera == null)
|
if (camera == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -318,6 +322,9 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O
|
|||||||
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
|
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
|
||||||
|
|
||||||
camera.setParameters(parameters);
|
camera.setParameters(parameters);
|
||||||
|
if (takePictureAfter) {
|
||||||
|
takePicture();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -600,7 +607,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
focusArea();
|
focusArea(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user