|
|
@ -114,6 +114,7 @@ public class CameraView extends FrameLayout {
|
|
|
|
host.onCameraFail(result);
|
|
|
|
host.onCameraFail(result);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
cameraReady = true;
|
|
|
|
cameraReady = true;
|
|
|
|
if (getActivity().getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
|
|
|
|
if (getActivity().getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
|
|
|
|
onOrientationChange.enable();
|
|
|
|
onOrientationChange.enable();
|
|
|
@ -127,6 +128,14 @@ public class CameraView extends FrameLayout {
|
|
|
|
requestLayout();
|
|
|
|
requestLayout();
|
|
|
|
invalidate();
|
|
|
|
invalidate();
|
|
|
|
Log.w(TAG, "onResume() completed");
|
|
|
|
Log.w(TAG, "onResume() completed");
|
|
|
|
|
|
|
|
} catch (RuntimeException re) {
|
|
|
|
|
|
|
|
Log.w(TAG, "exception when starting camera preview", re);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
previewDestroyed();
|
|
|
|
|
|
|
|
} catch (RuntimeException re2) {
|
|
|
|
|
|
|
|
Log.w(TAG, "also failed to release camera", re2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -272,9 +281,12 @@ public class CameraView extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void previewDestroyed() {
|
|
|
|
void previewDestroyed() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
if (camera != null) {
|
|
|
|
if (camera != null) {
|
|
|
|
previewStopped();
|
|
|
|
previewStopped();
|
|
|
|
camera.release();
|
|
|
|
camera.release();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
camera = null;
|
|
|
|
camera = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|