Package org.robolectric.shadows
Class ShadowCamera
java.lang.Object
org.robolectric.shadows.ShadowCamera
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classShadows the AndroidCamera.Parametersclass. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCallbackBuffer(byte[] callbackBuffer) static voidaddCameraInfo(int id, Camera.CameraInfo camInfo) Add a mockCamera.CameraInfoobject to simulate the existence of one or more cameras.protected voidautoFocus(Camera.AutoFocusCallback callback) protected voidstatic voidprotected booleanenableShutterSound(boolean enabled) List<byte[]>protected static voidgetCameraInfo(int cameraId, Camera.CameraInfo cameraInfo) intstatic intprotected static intprotected Camera.ParametersbooleanvoidinvokeAutoFocusCallback(boolean success, Camera camera) voidinvokePreviewCallback(byte[] data) Allows test cases to invoke the preview callback, to simulate a frame of camera data.booleanisLocked()booleanbooleanbooleanReturnstrueif the default shutter sound is played when taking a picture.protected static Cameraopen()protected static Cameraopen(int cameraId) protected voidprotected voidrelease()protected voidsetDisplayOrientation(int degrees) protected voidprotected voidsetParameters(Camera.Parameters params) protected voidprotected voidprotected voidsetPreviewDisplay(SurfaceHolder holder) protected voidprotected voidprotected voidtakePicture(Camera.ShutterCallback shutter, Camera.PictureCallback raw, Camera.PictureCallback jpeg) protected voidunlock()
-
Constructor Details
-
ShadowCamera
public ShadowCamera()
-
-
Method Details
-
open
-
open
-
getLastOpenedCameraId
public static int getLastOpenedCameraId() -
unlock
-
reconnect
-
getParameters
-
setParameters
-
setPreviewDisplay
-
startPreview
-
stopPreview
-
release
-
setPreviewCallback
-
setOneShotPreviewCallback
-
setPreviewCallbackWithBuffer
-
invokePreviewCallback
public void invokePreviewCallback(byte[] data) Allows test cases to invoke the preview callback, to simulate a frame of camera data.- Parameters:
data- byte buffer of simulated camera data
-
addCallbackBuffer
-
getAddedCallbackBuffers
-
setDisplayOrientation
-
getDisplayOrientation
public int getDisplayOrientation() -
autoFocus
-
cancelAutoFocus
-
hasRequestedAutoFocus
public boolean hasRequestedAutoFocus() -
invokeAutoFocusCallback
-
getCameraInfo
-
getNumberOfCameras
-
takePicture
@Implementation protected void takePicture(Camera.ShutterCallback shutter, Camera.PictureCallback raw, Camera.PictureCallback jpeg) -
enableShutterSound
-
isShutterSoundEnabled
public boolean isShutterSoundEnabled()Returnstrueif the default shutter sound is played when taking a picture. -
isLocked
public boolean isLocked() -
isPreviewing
public boolean isPreviewing() -
isReleased
public boolean isReleased() -
getPreviewDisplay
-
addCameraInfo
Add a mockCamera.CameraInfoobject to simulate the existence of one or more cameras. By default, no cameras are defined.- Parameters:
id- The camera idcamInfo- The CameraInfo
-
clearCameraInfo
-