@Implements(android.hardware.Camera.class) public class ShadowCamera extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
ShadowCamera.ShadowParameters |
Shadows the Android
Camera.Parameters class. |
static class |
ShadowCamera.ShadowSize |
Constructor | Description |
---|---|
ShadowCamera() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
__constructor__() |
|
protected void |
addCallbackBuffer(byte[] callbackBuffer) |
|
static void |
addCameraInfo(int id,
Camera.CameraInfo camInfo) |
Add a mock
Camera.CameraInfo object to simulate the existence of one or more cameras. |
protected void |
autoFocus(Camera.AutoFocusCallback callback) |
|
protected void |
cancelAutoFocus() |
|
static void |
clearCameraInfo() |
|
protected boolean |
enableShutterSound(boolean enabled) |
|
List<byte[]> |
getAddedCallbackBuffers() |
|
protected static void |
getCameraInfo(int cameraId,
Camera.CameraInfo cameraInfo) |
|
int |
getDisplayOrientation() |
|
static int |
getLastOpenedCameraId() |
|
protected static int |
getNumberOfCameras() |
|
protected Camera.Parameters |
getParameters() |
|
SurfaceHolder |
getPreviewDisplay() |
|
boolean |
hasRequestedAutoFocus() |
|
void |
invokeAutoFocusCallback(boolean success,
Camera camera) |
|
void |
invokePreviewCallback(byte[] data) |
Allows test cases to invoke the preview callback, to simulate a frame of camera data.
|
boolean |
isLocked() |
|
boolean |
isPreviewing() |
|
boolean |
isReleased() |
|
boolean |
isShutterSoundEnabled() |
Returns
true if the default shutter sound is played when taking a picture. |
protected static Camera |
open() |
|
protected static Camera |
open(int cameraId) |
|
protected void |
reconnect() |
|
protected void |
release() |
|
protected void |
setDisplayOrientation(int degrees) |
|
protected void |
setOneShotPreviewCallback(Camera.PreviewCallback cb) |
|
protected void |
setParameters(Camera.Parameters params) |
|
protected void |
setPreviewCallback(Camera.PreviewCallback cb) |
|
protected void |
setPreviewCallbackWithBuffer(Camera.PreviewCallback cb) |
|
protected void |
setPreviewDisplay(SurfaceHolder holder) |
|
protected void |
startPreview() |
|
protected void |
stopPreview() |
|
protected void |
takePicture(Camera.ShutterCallback shutter,
Camera.PictureCallback raw,
Camera.PictureCallback jpeg) |
|
protected void |
unlock() |
@Implementation protected void __constructor__()
@Implementation protected static Camera open()
@Implementation protected static Camera open(int cameraId)
public static int getLastOpenedCameraId()
@Implementation protected void unlock()
@Implementation protected void reconnect()
@Implementation protected Camera.Parameters getParameters()
@Implementation protected void setParameters(Camera.Parameters params)
@Implementation protected void setPreviewDisplay(SurfaceHolder holder)
@Implementation protected void startPreview()
@Implementation protected void stopPreview()
@Implementation protected void release()
@Implementation protected void setPreviewCallback(Camera.PreviewCallback cb)
@Implementation protected void setOneShotPreviewCallback(Camera.PreviewCallback cb)
@Implementation protected void setPreviewCallbackWithBuffer(Camera.PreviewCallback cb)
public void invokePreviewCallback(byte[] data)
data
- byte buffer of simulated camera data@Implementation protected void addCallbackBuffer(byte[] callbackBuffer)
public List<byte[]> getAddedCallbackBuffers()
@Implementation protected void setDisplayOrientation(int degrees)
public int getDisplayOrientation()
@Implementation protected void autoFocus(Camera.AutoFocusCallback callback)
@Implementation protected void cancelAutoFocus()
public boolean hasRequestedAutoFocus()
public void invokeAutoFocusCallback(boolean success, Camera camera)
@Implementation protected static void getCameraInfo(int cameraId, Camera.CameraInfo cameraInfo)
@Implementation protected static int getNumberOfCameras()
@Implementation protected void takePicture(Camera.ShutterCallback shutter, Camera.PictureCallback raw, Camera.PictureCallback jpeg)
@Implementation(minSdk=17) protected boolean enableShutterSound(boolean enabled)
public boolean isShutterSoundEnabled()
true
if the default shutter sound is played when taking a picture.public boolean isLocked()
public boolean isPreviewing()
public boolean isReleased()
public SurfaceHolder getPreviewDisplay()
public static void addCameraInfo(int id, Camera.CameraInfo camInfo)
Camera.CameraInfo
object to simulate the existence of one or more cameras.
By default, no cameras are defined.id
- The camera idcamInfo
- The CameraInfopublic static void clearCameraInfo()