Control commit
This commit is contained in:
parent
6166aed715
commit
756dedd737
1 changed files with 11 additions and 22 deletions
|
@ -5,7 +5,6 @@ import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.ImageFormat;
|
import android.graphics.ImageFormat;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
|
@ -93,8 +92,11 @@ public class SegpassCamera {
|
||||||
* Error constants
|
* Error constants
|
||||||
*/
|
*/
|
||||||
private static final String ERROR_MSG_CAMERA_ACCESS = "Error de acceso a cámara.";
|
private static final String ERROR_MSG_CAMERA_ACCESS = "Error de acceso a cámara.";
|
||||||
|
private static final String ERROR_MSG_CAMERA_RUNTIME = "Error en ejecución de cámara.";
|
||||||
|
private static final String ERROR_MSG_CAMERA_CONFIG_FAILED = "Error en configuración de cámara.";
|
||||||
private static final String ERROR_MSG_CAMERA_TIMEOUT = "Tiempo de espera para bloqueo de cámara excedido.";
|
private static final String ERROR_MSG_CAMERA_TIMEOUT = "Tiempo de espera para bloqueo de cámara excedido.";
|
||||||
private static final String ERROR_MSG_NO_CAMERA_PREVIEW_SIZE = "No se encontraron tamaños de imagen compatible.";
|
private static final String ERROR_MSG_NO_CAMERA_PREVIEW_SIZE = "No se encontraron tamaños de imagen compatible.";
|
||||||
|
private static final String ERROR_MSG_NO_CAMERA_CONFIGURATION_FOUND = "Error: no se encontró configuración de cámara";
|
||||||
|
|
||||||
private static final String ERROR_STATE_MSG_CAMERA_IN_USE = "Error: cámara en uso por otro proceso.";
|
private static final String ERROR_STATE_MSG_CAMERA_IN_USE = "Error: cámara en uso por otro proceso.";
|
||||||
private static final String ERROR_STATE_MSG_MAX_CAMERAS_IN_USE = "Error: máximo número de camaras en uso.";
|
private static final String ERROR_STATE_MSG_MAX_CAMERAS_IN_USE = "Error: máximo número de camaras en uso.";
|
||||||
|
@ -152,11 +154,6 @@ public class SegpassCamera {
|
||||||
*/
|
*/
|
||||||
private Image mImage;
|
private Image mImage;
|
||||||
|
|
||||||
/**
|
|
||||||
* The bitmap to be shown in the preview to be accepted or discarded
|
|
||||||
*/
|
|
||||||
private Bitmap mBitmap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link CaptureRequest.Builder} for the camera preview
|
* {@link CaptureRequest.Builder} for the camera preview
|
||||||
*/
|
*/
|
||||||
|
@ -436,10 +433,10 @@ public class SegpassCamera {
|
||||||
}
|
}
|
||||||
} catch (CameraAccessException e) {
|
} catch (CameraAccessException e) {
|
||||||
Log.e(TAG, "CameraAccessException@setUpCameraOutputs(): " + e.getMessage());
|
Log.e(TAG, "CameraAccessException@setUpCameraOutputs(): " + e.getMessage());
|
||||||
mCameraCallback.onCameraInitError(e.getMessage());
|
mCameraCallback.onCameraInitError(ERROR_MSG_CAMERA_ACCESS);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
Log.e(TAG, "NullPointerException@setUpCameraOutputs(): " + e.getMessage());
|
Log.e(TAG, "NullPointerException@setUpCameraOutputs(): " + e.getMessage());
|
||||||
mCameraCallback.onCameraInitError(e.getMessage());
|
mCameraCallback.onCameraInitError(ERROR_MSG_NO_CAMERA_CONFIGURATION_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,10 +579,11 @@ public class SegpassCamera {
|
||||||
manager.openCamera(mCameraId, mStateCallback, mBackgroundHandler);
|
manager.openCamera(mCameraId, mStateCallback, mBackgroundHandler);
|
||||||
} catch (CameraAccessException e) {
|
} catch (CameraAccessException e) {
|
||||||
Log.e(TAG, "CameraAccessException@openCamera(): " + e.getMessage());
|
Log.e(TAG, "CameraAccessException@openCamera(): " + e.getMessage());
|
||||||
mCameraCallback.onCameraInitError(e.getMessage());
|
mCameraCallback.onCameraInitError(ERROR_MSG_CAMERA_ACCESS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
mBackgroundThread.interrupt();
|
|
||||||
Log.e(TAG, "InterruptedException@openCamera(): " + e.getMessage());
|
Log.e(TAG, "InterruptedException@openCamera(): " + e.getMessage());
|
||||||
|
mCameraCallback.onCameraInitError(ERROR_MSG_CAMERA_RUNTIME);
|
||||||
|
mBackgroundThread.interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,14 +652,14 @@ public class SegpassCamera {
|
||||||
null, mBackgroundHandler);
|
null, mBackgroundHandler);
|
||||||
} catch (CameraAccessException e) {
|
} catch (CameraAccessException e) {
|
||||||
Log.e(TAG, "onConfigured(): " + e.getMessage());
|
Log.e(TAG, "onConfigured(): " + e.getMessage());
|
||||||
mCameraCallback.onCameraInitError(e.getMessage());
|
mCameraCallback.onCameraInitError(ERROR_MSG_CAMERA_ACCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigureFailed(
|
public void onConfigureFailed(
|
||||||
@NonNull CameraCaptureSession cameraCaptureSession) {
|
@NonNull CameraCaptureSession cameraCaptureSession) {
|
||||||
mCameraCallback.onCameraInitError("Camera capture session failed.");
|
mCameraCallback.onCameraInitError(ERROR_MSG_CAMERA_CONFIG_FAILED);
|
||||||
}
|
}
|
||||||
}, null
|
}, null
|
||||||
);
|
);
|
||||||
|
@ -754,16 +752,7 @@ public class SegpassCamera {
|
||||||
@Override
|
@Override
|
||||||
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
|
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
|
||||||
super.onCaptureCompleted(session, request, result);
|
super.onCaptureCompleted(session, request, result);
|
||||||
/*if (mBase64Value != null) {
|
// No code needed here, events are handled separately.
|
||||||
Log.i(TAG, "onCaptureCompleted@takePicture(): sending Base64 result on callback... ");
|
|
||||||
mCameraCallback.onPictureTakenSuccess(mBase64Value);
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, "onCaptureCompleted@takePicture(): error saving picture, base64 value is null.");
|
|
||||||
mCameraCallback.onPictureTakenFailError("Error saving picture...");
|
|
||||||
}
|
|
||||||
Log.d(TAG, "Recreating camera preview...");
|
|
||||||
createCameraPreviewSession(); // This is called if the picture is discarded*/
|
|
||||||
//mPictureSavedListener.onPicturePreview();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue