本文整理匯總了Java中com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration.MEDIA_ACTION_PHOTO屬性的典型用法代碼示例。如果您正苦於以下問題:Java CameraConfiguration.MEDIA_ACTION_PHOTO屬性的具體用法?Java CameraConfiguration.MEDIA_ACTION_PHOTO怎麽用?Java CameraConfiguration.MEDIA_ACTION_PHOTO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration
的用法示例。
在下文中一共展示了CameraConfiguration.MEDIA_ACTION_PHOTO屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getOutputMediaFile
public static File getOutputMediaFile(Context context, @CameraConfiguration.MediaAction int mediaAction) {
File mediaStorageDir = context.getFilesDir();
if (!mediaStorageDir.exists()) {
if (!mediaStorageDir.mkdirs()) {
Log.d(TAG, "Failed to create directory.");
return null;
}
}
String timeStamp = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss", Locale.ENGLISH)
.format(new Date());
File mediaFile;
if (mediaAction == CameraConfiguration.MEDIA_ACTION_PHOTO) {
mediaFile = new File(mediaStorageDir.getPath() + File.separator +
"IMG_" + timeStamp + ".jpg");
} else if (mediaAction == CameraConfiguration.MEDIA_ACTION_VIDEO) {
mediaFile = new File(mediaStorageDir.getPath() + File.separator +
"VID_" + timeStamp + ".mp4");
} else {
return null;
}
return mediaFile;
}
示例2: prepareCameraOutputs
@Override
protected void prepareCameraOutputs() {
try {
if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_AUTO) {
camcorderProfile = CameraHelper.getCamcorderProfile(currentCameraId, configurationProvider.getVideoFileSize(), configurationProvider.getMinimumVideoDuration());
} else
camcorderProfile = CameraHelper.getCamcorderProfile(configurationProvider.getMediaQuality(), currentCameraId);
List<Size> previewSizes = Size.fromList(camera.getParameters().getSupportedPreviewSizes());
List<Size> pictureSizes = Size.fromList(camera.getParameters().getSupportedPictureSizes());
List<Size> videoSizes;
if (Build.VERSION.SDK_INT > 10)
videoSizes = Size.fromList(camera.getParameters().getSupportedVideoSizes());
else videoSizes = previewSizes;
videoSize = CameraHelper.getSizeWithClosestRatio(
(videoSizes == null || videoSizes.isEmpty()) ? previewSizes : videoSizes,
camcorderProfile.videoFrameWidth, camcorderProfile.videoFrameHeight);
photoSize = CameraHelper.getPictureSize(
(pictureSizes == null || pictureSizes.isEmpty()) ? previewSizes : pictureSizes,
configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_AUTO
? CameraConfiguration.MEDIA_QUALITY_HIGHEST : configurationProvider.getMediaQuality());
if (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_PHOTO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH) {
previewSize = CameraHelper.getSizeWithClosestRatio(previewSizes, photoSize.getWidth(), photoSize.getHeight());
} else {
previewSize = CameraHelper.getSizeWithClosestRatio(previewSizes, videoSize.getWidth(), videoSize.getHeight());
}
} catch (Exception e) {
Log.e(TAG, "Error while setup camera sizes.");
}
}
示例3: setMediaAction
public void setMediaAction(@CameraConfiguration.MediaAction int mediaAction) {
this.mediaAction = mediaAction;
if (CameraConfiguration.MEDIA_ACTION_PHOTO == mediaAction)
currentState = TAKE_PHOTO_STATE;
else currentState = READY_FOR_RECORD_STATE;
setRecordState(currentState);
setIcon();
}
示例4: prepareCameraOutputs
@Override
protected void prepareCameraOutputs() {
try {
if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_AUTO) {
camcorderProfile = CameraHelper.getCamcorderProfile(currentCameraId, configurationProvider.getVideoFileSize(), configurationProvider.getMinimumVideoDuration());
} else
camcorderProfile = CameraHelper.getCamcorderProfile(configurationProvider.getMediaQuality(), currentCameraId);
List<Size> previewSizes = Size.fromList(camera.getParameters().getSupportedPreviewSizes());
List<Size> pictureSizes = Size.fromList(camera.getParameters().getSupportedPictureSizes());
List<Size> videoSizes;
videoSizes = Size.fromList(camera.getParameters().getSupportedVideoSizes());
videoSize = CameraHelper.getSizeWithClosestRatio(
(videoSizes == null || videoSizes.isEmpty()) ? previewSizes : videoSizes,
camcorderProfile.videoFrameWidth, camcorderProfile.videoFrameHeight);
photoSize = CameraHelper.getPictureSize(
(pictureSizes == null || pictureSizes.isEmpty()) ? previewSizes : pictureSizes,
configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_AUTO
? CameraConfiguration.MEDIA_QUALITY_HIGHEST : configurationProvider.getMediaQuality());
if (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_PHOTO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH) {
previewSize = CameraHelper.getSizeWithClosestRatio(previewSizes, photoSize.getWidth(), photoSize.getHeight());
} else {
previewSize = CameraHelper.getSizeWithClosestRatio(previewSizes, videoSize.getWidth(), videoSize.getHeight());
}
} catch (Exception e) {
Log.e(TAG, "Error while setup camera sizes.");
}
}
示例5: startPreview
private void startPreview(SurfaceHolder surfaceHolder) {
try {
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
Camera.getCameraInfo(currentCameraId, cameraInfo);
int cameraRotationOffset = cameraInfo.orientation;
Camera.Parameters parameters = camera.getParameters();
setAutoFocus(camera, parameters);
setFlashMode(configurationProvider.getFlashMode());
if (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_PHOTO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH)
turnPhotoCameraFeaturesOn(camera, parameters);
else if (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_PHOTO)
turnVideoCameraFeaturesOn(camera, parameters);
int rotation = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
int degrees = 0;
switch (rotation) {
case Surface.ROTATION_0:
degrees = 0;
break; // Natural orientation
case Surface.ROTATION_90:
degrees = 90;
break; // Landscape left
case Surface.ROTATION_180:
degrees = 180;
break;// Upside down
case Surface.ROTATION_270:
degrees = 270;
break;// Landscape right
}
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
displayRotation = (cameraRotationOffset + degrees) % 360;
displayRotation = (360 - displayRotation) % 360; // compensate
} else {
displayRotation = (cameraRotationOffset - degrees + 360) % 360;
}
this.camera.setDisplayOrientation(displayRotation);
if (Build.VERSION.SDK_INT > 13
&& (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_VIDEO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH)) {
// parameters.setRecordingHint(true);
}
if (Build.VERSION.SDK_INT > 14
&& parameters.isVideoStabilizationSupported()
&& (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_VIDEO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH)) {
parameters.setVideoStabilization(true);
}
parameters.setPreviewSize(previewSize.getWidth(), previewSize.getHeight());
parameters.setPictureSize(photoSize.getWidth(), photoSize.getHeight());
camera.setParameters(parameters);
camera.setPreviewDisplay(surfaceHolder);
camera.startPreview();
} catch (IOException error) {
Log.d(TAG, "Error setting camera preview: " + error.getMessage());
} catch (Exception ignore) {
Log.d(TAG, "Error starting camera preview: " + ignore.getMessage());
}
}
示例6: extractConfiguration
private void extractConfiguration(Bundle bundle) {
if (bundle != null) {
if (bundle.containsKey(CameraConfiguration.Arguments.REQUEST_CODE))
requestCode = bundle.getInt(CameraConfiguration.Arguments.REQUEST_CODE);
if (bundle.containsKey(CameraConfiguration.Arguments.MEDIA_ACTION)) {
switch (bundle.getInt(CameraConfiguration.Arguments.MEDIA_ACTION)) {
case CameraConfiguration.MEDIA_ACTION_PHOTO:
mediaAction = CameraConfiguration.MEDIA_ACTION_PHOTO;
break;
case CameraConfiguration.MEDIA_ACTION_VIDEO:
mediaAction = CameraConfiguration.MEDIA_ACTION_VIDEO;
break;
default:
mediaAction = CameraConfiguration.MEDIA_ACTION_BOTH;
break;
}
}
if (bundle.containsKey(CameraConfiguration.Arguments.MEDIA_QUALITY)) {
switch (bundle.getInt(CameraConfiguration.Arguments.MEDIA_QUALITY)) {
case CameraConfiguration.MEDIA_QUALITY_AUTO:
mediaQuality = CameraConfiguration.MEDIA_QUALITY_AUTO;
break;
case CameraConfiguration.MEDIA_QUALITY_HIGHEST:
mediaQuality = CameraConfiguration.MEDIA_QUALITY_HIGHEST;
break;
case CameraConfiguration.MEDIA_QUALITY_HIGH:
mediaQuality = CameraConfiguration.MEDIA_QUALITY_HIGH;
break;
case CameraConfiguration.MEDIA_QUALITY_MEDIUM:
mediaQuality = CameraConfiguration.MEDIA_QUALITY_MEDIUM;
break;
case CameraConfiguration.MEDIA_QUALITY_LOW:
mediaQuality = CameraConfiguration.MEDIA_QUALITY_LOW;
break;
case CameraConfiguration.MEDIA_QUALITY_LOWEST:
mediaQuality = CameraConfiguration.MEDIA_QUALITY_LOWEST;
break;
default:
mediaQuality = CameraConfiguration.MEDIA_QUALITY_MEDIUM;
break;
}
passedMediaQuality = mediaQuality;
}
if (bundle.containsKey(CameraConfiguration.Arguments.VIDEO_DURATION))
videoDuration = bundle.getInt(CameraConfiguration.Arguments.VIDEO_DURATION);
if (bundle.containsKey(CameraConfiguration.Arguments.VIDEO_FILE_SIZE))
videoFileSize = bundle.getLong(CameraConfiguration.Arguments.VIDEO_FILE_SIZE);
if (bundle.containsKey(CameraConfiguration.Arguments.MINIMUM_VIDEO_DURATION))
minimumVideoDuration = bundle.getInt(CameraConfiguration.Arguments.MINIMUM_VIDEO_DURATION);
if (bundle.containsKey(CameraConfiguration.Arguments.SHOW_PICKER))
showPicker = bundle.getBoolean(CameraConfiguration.Arguments.SHOW_PICKER);
if (bundle.containsKey(CameraConfiguration.Arguments.ENABLE_CROP))
enableImageCrop = bundle.getBoolean(CameraConfiguration.Arguments.ENABLE_CROP);
if (bundle.containsKey(CameraConfiguration.Arguments.FLASH_MODE))
switch (bundle.getInt(CameraConfiguration.Arguments.FLASH_MODE)) {
case CameraConfiguration.FLASH_MODE_AUTO:
flashMode = CameraConfiguration.FLASH_MODE_AUTO;
break;
case CameraConfiguration.FLASH_MODE_ON:
flashMode = CameraConfiguration.FLASH_MODE_ON;
break;
case CameraConfiguration.FLASH_MODE_OFF:
flashMode = CameraConfiguration.FLASH_MODE_OFF;
break;
default:
flashMode = CameraConfiguration.FLASH_MODE_AUTO;
break;
}
}
}
示例7: onCreate
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
mContext = this;
surfaceView = (SurfaceView) findViewById(R.id.video_preview);
//隱藏掉Seekbar
// surfaceView.setOnTouchListener(new View.OnTouchListener() {
// @Override
// public boolean onTouch(View v, MotionEvent event) {
// if (mediaController == null) return false;
// if (mediaController.isShowing()) {
// mediaController.hide();
// showButtonPanel(true);
// } else {
// showButtonPanel(false);
// mediaController.show();
// }
// return false;
// }
// });
videoPreviewContainer = (AspectFrameLayout) findViewById(R.id.previewAspectFrameLayout);
photoPreviewContainer = (FrameLayout) findViewById(R.id.photo_preview_container);
imagePreview = (UCropView) findViewById(R.id.image_view);
buttonPanel = (ViewGroup) findViewById(R.id.preview_control_panel);
View confirmMediaResult = findViewById(R.id.confirm_media_result);
View reTakeMedia = findViewById(R.id.re_take_media);
View cancelMediaAction = findViewById(R.id.cancel_media_action);
findViewById(R.id.crop_image).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
UCrop.Options options = new UCrop.Options();
options.setToolbarColor(ContextCompat.getColor(mContext, android.R.color.black));
options.setStatusBarColor(ContextCompat.getColor(mContext, android.R.color.black));
Uri uri = Uri.fromFile(new File(previewFilePath));
UCrop.of(uri, uri)
.withOptions(options)
.start(mContext);
}
});
if (confirmMediaResult != null)
confirmMediaResult.setOnClickListener(this);
if (reTakeMedia != null)
reTakeMedia.setOnClickListener(this);
if (cancelMediaAction != null)
cancelMediaAction.setOnClickListener(this);
Bundle args = getIntent().getExtras();
mediaAction = args.getInt(MEDIA_ACTION_ARG);
previewFilePath = args.getString(FILE_PATH_ARG);
showCrop = args.getBoolean(SHOW_CROP);
if (mediaAction == CameraConfiguration.MEDIA_ACTION_VIDEO) {
displayVideo(savedInstanceState);
} else if (mediaAction == CameraConfiguration.MEDIA_ACTION_PHOTO) {
displayImage();
} else {
String mimeType = Utils.getMimeType(previewFilePath);
if (mimeType.contains(MIME_TYPE_VIDEO)) {
displayVideo(savedInstanceState);
} else if (mimeType.contains(MIME_TYPE_IMAGE)) {
displayImage();
} else finish();
}
}
示例8: prepareCameraOutputs
@Override
protected void prepareCameraOutputs() {
try {
CameraCharacteristics characteristics = currentCameraId.equals(faceBackCameraId) ? backCameraCharacteristics : frontCameraCharacteristics;
if (currentCameraId.equals(faceFrontCameraId) && frontCameraStreamConfigurationMap == null)
frontCameraStreamConfigurationMap = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
else if (currentCameraId.equals(faceBackCameraId) && backCameraStreamConfigurationMap == null)
backCameraStreamConfigurationMap = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
StreamConfigurationMap map = currentCameraId.equals(faceBackCameraId) ? backCameraStreamConfigurationMap : frontCameraStreamConfigurationMap;
if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_AUTO) {
camcorderProfile = CameraHelper.getCamcorderProfile(currentCameraId, configurationProvider.getVideoFileSize(), configurationProvider.getMinimumVideoDuration());
} else
camcorderProfile = CameraHelper.getCamcorderProfile(configurationProvider.getMediaQuality(), currentCameraId);
videoSize = CameraHelper.chooseOptimalSize(Size.fromArray2(map.getOutputSizes(MediaRecorder.class)),
windowSize.getWidth(), windowSize.getHeight(), new Size(camcorderProfile.videoFrameWidth, camcorderProfile.videoFrameHeight));
if (videoSize == null || videoSize.getWidth() > camcorderProfile.videoFrameWidth
|| videoSize.getHeight() > camcorderProfile.videoFrameHeight)
videoSize = CameraHelper.getSizeWithClosestRatio(Size.fromArray2(map.getOutputSizes(MediaRecorder.class)), camcorderProfile.videoFrameWidth, camcorderProfile.videoFrameHeight);
else if (videoSize == null || videoSize.getWidth() > camcorderProfile.videoFrameWidth
|| videoSize.getHeight() > camcorderProfile.videoFrameHeight)
videoSize = CameraHelper.getSizeWithClosestRatio(Size.fromArray2(map.getOutputSizes(MediaRecorder.class)), camcorderProfile.videoFrameWidth, camcorderProfile.videoFrameHeight);
photoSize = CameraHelper.getPictureSize(Size.fromArray2(map.getOutputSizes(ImageFormat.JPEG)),
configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_AUTO
? CameraConfiguration.MEDIA_QUALITY_HIGHEST : configurationProvider.getMediaQuality());
imageReader = ImageReader.newInstance(photoSize.getWidth(), photoSize.getHeight(),
ImageFormat.JPEG, 2);
imageReader.setOnImageAvailableListener(this, backgroundHandler);
if (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_PHOTO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH) {
if (windowSize.getHeight() * windowSize.getWidth() > photoSize.getWidth() * photoSize.getHeight()) {
previewSize = CameraHelper.getOptimalPreviewSize(Size.fromArray2(map.getOutputSizes(SurfaceTexture.class)), photoSize.getWidth(), photoSize.getHeight());
} else {
previewSize = CameraHelper.getOptimalPreviewSize(Size.fromArray2(map.getOutputSizes(SurfaceTexture.class)), windowSize.getWidth(), windowSize.getHeight());
}
if (previewSize == null)
previewSize = CameraHelper.chooseOptimalSize(Size.fromArray2(map.getOutputSizes(SurfaceTexture.class)), windowSize.getWidth(), windowSize.getHeight(), photoSize);
} else {
if (windowSize.getHeight() * windowSize.getWidth() > videoSize.getWidth() * videoSize.getHeight()) {
previewSize = CameraHelper.getOptimalPreviewSize(Size.fromArray2(map.getOutputSizes(SurfaceTexture.class)), videoSize.getWidth(), videoSize.getHeight());
} else {
previewSize = CameraHelper.getOptimalPreviewSize(Size.fromArray2(map.getOutputSizes(SurfaceTexture.class)), windowSize.getWidth(), windowSize.getHeight());
}
if (previewSize == null)
previewSize = CameraHelper.getSizeWithClosestRatio(Size.fromArray2(map.getOutputSizes(SurfaceTexture.class)), videoSize.getWidth(), videoSize.getHeight());
}
} catch (Exception e) {
Log.e(TAG, "Error while setup camera sizes.", e);
}
}
示例9: startPreview
private void startPreview(SurfaceHolder surfaceHolder) {
try {
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
Camera.getCameraInfo(currentCameraId, cameraInfo);
int cameraRotationOffset = cameraInfo.orientation;
Camera.Parameters parameters = camera.getParameters();
setAutoFocus(camera, parameters);
setFlashMode(configurationProvider.getFlashMode());
if (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_PHOTO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH)
turnPhotoCameraFeaturesOn(camera, parameters);
else if (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_PHOTO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH)
turnVideoCameraFeaturesOn(camera, parameters);
int rotation = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
int degrees = 0;
switch (rotation) {
case Surface.ROTATION_0:
degrees = 0;
break; // Natural orientation
case Surface.ROTATION_90:
degrees = 90;
break; // Landscape left
case Surface.ROTATION_180:
degrees = 180;
break;// Upside down
case Surface.ROTATION_270:
degrees = 270;
break;// Landscape right
}
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
displayRotation = (cameraRotationOffset + degrees) % 360;
displayRotation = (360 - displayRotation) % 360; // compensate
} else {
displayRotation = (cameraRotationOffset - degrees + 360) % 360;
}
this.camera.setDisplayOrientation(displayRotation);
if (Build.VERSION.SDK_INT > 14
&& parameters.isVideoStabilizationSupported()
&& (configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_VIDEO
|| configurationProvider.getMediaAction() == CameraConfiguration.MEDIA_ACTION_BOTH)) {
parameters.setVideoStabilization(true);
}
parameters.setPreviewSize(previewSize.getWidth(), previewSize.getHeight());
parameters.setPictureSize(photoSize.getWidth(), photoSize.getHeight());
camera.setParameters(parameters);
camera.setPreviewDisplay(surfaceHolder);
camera.startPreview();
safeToTakePicture = true;
} catch (IOException error) {
Log.d(TAG, "Error setting camera preview: " + error.getMessage());
} catch (Exception ignore) {
Log.d(TAG, "Error starting camera preview: " + ignore.getMessage());
}
}
示例10: onCreate
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
mContext = this;
surfaceView = (SurfaceView) findViewById(R.id.video_preview);
surfaceView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mediaController == null) return false;
if (mediaController.isShowing()) {
mediaController.hide();
showButtonPanel(true);
} else {
showButtonPanel(false);
mediaController.show();
}
return false;
}
});
videoPreviewContainer = (AspectFrameLayout) findViewById(R.id.previewAspectFrameLayout);
photoPreviewContainer = (FrameLayout) findViewById(R.id.photo_preview_container);
imagePreview = (UCropView) findViewById(R.id.image_view);
buttonPanel = (ViewGroup) findViewById(R.id.preview_control_panel);
View confirmMediaResult = findViewById(R.id.confirm_media_result);
View reTakeMedia = findViewById(R.id.re_take_media);
View cancelMediaAction = findViewById(R.id.cancel_media_action);
findViewById(R.id.crop_image).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
UCrop.Options options = new UCrop.Options();
options.setToolbarColor(ContextCompat.getColor(mContext, android.R.color.black));
options.setStatusBarColor(ContextCompat.getColor(mContext, android.R.color.black));
Uri uri = Uri.fromFile(new File(previewFilePath));
UCrop.of(uri, uri)
.withOptions(options)
.start(mContext);
}
});
if (confirmMediaResult != null)
confirmMediaResult.setOnClickListener(this);
if (reTakeMedia != null)
reTakeMedia.setOnClickListener(this);
if (cancelMediaAction != null)
cancelMediaAction.setOnClickListener(this);
Bundle args = getIntent().getExtras();
mediaAction = args.getInt(MEDIA_ACTION_ARG);
previewFilePath = args.getString(FILE_PATH_ARG);
showCrop = args.getBoolean(SHOW_CROP);
if (mediaAction == CameraConfiguration.MEDIA_ACTION_VIDEO) {
displayVideo(savedInstanceState);
} else if (mediaAction == CameraConfiguration.MEDIA_ACTION_PHOTO) {
displayImage();
} else {
String mimeType = Utils.getMimeType(previewFilePath);
if (mimeType.contains(MIME_TYPE_VIDEO)) {
displayVideo(savedInstanceState);
} else if (mimeType.contains(MIME_TYPE_IMAGE)) {
displayImage();
} else finish();
}
}