parent
b65e9e446d
commit
e5ca52a8d7
@ -1,22 +0,0 @@ |
||||
package com.otaliastudios.cameraview; |
||||
|
||||
|
||||
import android.hardware.Camera; |
||||
|
||||
public class CameraConstants { |
||||
|
||||
public static final int PERMISSION_REQUEST_CODE = 16; |
||||
|
||||
public static final int SESSION_TYPE_PICTURE = 0; |
||||
public static final int SESSION_TYPE_VIDEO = 1; |
||||
|
||||
|
||||
static class Defaults { |
||||
|
||||
static final int DEFAULT_SESSION_TYPE = SESSION_TYPE_PICTURE; |
||||
static final int DEFAULT_JPEG_QUALITY = 100; |
||||
static final boolean DEFAULT_CROP_OUTPUT = false; |
||||
|
||||
|
||||
} |
||||
} |
@ -1,14 +1,56 @@ |
||||
package com.otaliastudios.cameraview; |
||||
|
||||
import android.support.annotation.IntDef; |
||||
|
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
|
||||
import static com.otaliastudios.cameraview.CameraConstants.SESSION_TYPE_PICTURE; |
||||
import static com.otaliastudios.cameraview.CameraConstants.SESSION_TYPE_VIDEO; |
||||
/** |
||||
* Type of the session to be opened or to move to. |
||||
* Session types have influence over the capture and preview size, ability to shoot pictures, |
||||
* focus modes, runtime permissions needed. |
||||
* |
||||
* @see CameraView#setSessionType(SessionType) |
||||
*/ |
||||
public enum SessionType { |
||||
|
||||
@Retention(RetentionPolicy.SOURCE) |
||||
@IntDef({SESSION_TYPE_PICTURE, SESSION_TYPE_VIDEO}) |
||||
public @interface SessionType { |
||||
/** |
||||
* Session optimized to capture pictures. |
||||
* |
||||
* - Trying to take videos in this session will throw an exception |
||||
* - Only the camera permission is requested |
||||
* - Preview and capture size is chosen as the max available size |
||||
*/ |
||||
PICTURE(0), |
||||
|
||||
/** |
||||
* Session optimized to capture videos. |
||||
* |
||||
* - Trying to take pictures in this session will work, though with lower quality |
||||
* - Trying to take pictures while recording a video will work if supported |
||||
* - Camera and audio record permissions are requested |
||||
* - Preview and capture size are chosen to respect the {@link VideoQuality} aspect ratio |
||||
* |
||||
* @see CameraOptions#isVideoSnapshotSupported() |
||||
*/ |
||||
VIDEO(1); |
||||
|
||||
static final SessionType DEFAULT = PICTURE; |
||||
|
||||
private int value; |
||||
|
||||
SessionType(int value) { |
||||
this.value = value; |
||||
} |
||||
|
||||
int value() { |
||||
return value; |
||||
} |
||||
|
||||
static SessionType fromValue(int value) { |
||||
SessionType[] list = SessionType.values(); |
||||
for (SessionType action : list) { |
||||
if (action.value() == value) { |
||||
return action; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue