本文整理汇总了Java中com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java CameraConfiguration类的具体用法?Java CameraConfiguration怎么用?Java CameraConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CameraConfiguration类属于com.sandrios.sandriosCamera.internal.configuration包,在下文中一共展示了CameraConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFlashMode
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
private void setFlashMode(Camera camera, Camera.Parameters parameters, @CameraConfiguration.FlashMode int flashMode) {
try {
switch (flashMode) {
case CameraConfiguration.FLASH_MODE_AUTO:
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
break;
case CameraConfiguration.FLASH_MODE_ON:
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON);
break;
case CameraConfiguration.FLASH_MODE_OFF:
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
break;
default:
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
break;
}
camera.setParameters(parameters);
} catch (Exception ignore) {
}
}
示例2: setCameraPhotoQuality
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
private void setCameraPhotoQuality(Camera camera) {
Camera.Parameters parameters = camera.getParameters();
parameters.setPictureFormat(PixelFormat.JPEG);
if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_LOW) {
parameters.setJpegQuality(50);
} else if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_MEDIUM) {
parameters.setJpegQuality(75);
} else if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_HIGH) {
parameters.setJpegQuality(100);
} else if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_HIGHEST) {
parameters.setJpegQuality(100);
}
//
parameters.setJpegQuality(50);
parameters.setPictureSize(photoSize.getWidth(), photoSize.getHeight());
camera.setParameters(parameters);
}
示例3: getPhotoOrientation
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
@Override
protected int getPhotoOrientation(@CameraConfiguration.SensorPosition int sensorPosition) {
int rotate;
if (currentCameraId.equals(faceFrontCameraId)) {
rotate = (360 + faceFrontCameraOrientation + configurationProvider.getDegrees()) % 360;
} else {
rotate = (360 + faceBackCameraOrientation - configurationProvider.getDegrees()) % 360;
}
if (rotate == 0) {
orientation = ExifInterface.ORIENTATION_NORMAL;
} else if (rotate == 90) {
orientation = ExifInterface.ORIENTATION_ROTATE_90;
} else if (rotate == 180) {
orientation = ExifInterface.ORIENTATION_ROTATE_180;
} else if (rotate == 270) {
orientation = ExifInterface.ORIENTATION_ROTATE_270;
}
return orientation;
}
示例4: getCamcorderProfile
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
public static CamcorderProfile getCamcorderProfile(int currentCameraId, long maximumFileSize, int minimumDurationInSeconds) {
if (maximumFileSize <= 0)
return CamcorderProfile.get(currentCameraId, CameraConfiguration.MEDIA_QUALITY_HIGHEST);
int[] qualities = new int[]{CameraConfiguration.MEDIA_QUALITY_HIGHEST,
CameraConfiguration.MEDIA_QUALITY_HIGH, CameraConfiguration.MEDIA_QUALITY_MEDIUM,
CameraConfiguration.MEDIA_QUALITY_LOW, CameraConfiguration.MEDIA_QUALITY_LOWEST};
CamcorderProfile camcorderProfile;
for (int i = 0; i < qualities.length; ++i) {
camcorderProfile = CameraHelper.getCamcorderProfile(qualities[i], currentCameraId);
double fileSize = CameraHelper.calculateApproximateVideoSize(camcorderProfile, minimumDurationInSeconds);
if (fileSize > maximumFileSize) {
long minimumRequiredBitRate = calculateMinimumRequiredBitRate(camcorderProfile, maximumFileSize, minimumDurationInSeconds);
if (minimumRequiredBitRate >= camcorderProfile.videoBitRate / 4 && minimumRequiredBitRate <= camcorderProfile.videoBitRate) {
camcorderProfile.videoBitRate = (int) minimumRequiredBitRate;
return camcorderProfile;
}
} else return camcorderProfile;
}
return CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_LOWEST, currentCameraId);
}
示例5: onFlashModeChanged
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
@Override
public void onFlashModeChanged(@FlashSwitchView.FlashMode int mode) {
switch (mode) {
case FlashSwitchView.FLASH_AUTO:
flashMode = CameraConfiguration.FLASH_MODE_AUTO;
getCameraController().setFlashMode(CameraConfiguration.FLASH_MODE_AUTO);
break;
case FlashSwitchView.FLASH_ON:
flashMode = CameraConfiguration.FLASH_MODE_ON;
getCameraController().setFlashMode(CameraConfiguration.FLASH_MODE_ON);
break;
case FlashSwitchView.FLASH_OFF:
flashMode = CameraConfiguration.FLASH_MODE_OFF;
getCameraController().setFlashMode(CameraConfiguration.FLASH_MODE_OFF);
break;
}
}
示例6: setup
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
public void setup(int mediaAction) {
this.mediaAction = mediaAction;
if (CameraConfiguration.MEDIA_ACTION_VIDEO == mediaAction) {
recordButton.setup(mediaAction, this);
flashSwitchView.setVisibility(GONE);
} else {
recordButton.setup(CameraConfiguration.MEDIA_ACTION_PHOTO, this);
}
if (CameraConfiguration.MEDIA_ACTION_BOTH != mediaAction) {
mediaActionSwitchView.setVisibility(GONE);
}
//这里让切换Icon消失
else mediaActionSwitchView.setVisibility(GONE);
}
示例7: onStopVideoRecord
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
public void onStopVideoRecord() {
//Set Progress
CircleAngleAnimation animation = new CircleAngleAnimation(circleProgressView, 0);
animation.setDuration(0);
circleProgressView.startAnimation(animation);
if (fileObserver != null)
fileObserver.stopWatching();
countDownTimer.stop();
//这里让recycleView消失
//recyclerView.setVisibility(VISIBLE);
recordSizeText.setVisibility(GONE);
cameraSwitchView.setVisibility(View.VISIBLE);
settingsButton.setVisibility(VISIBLE);
if (CameraConfiguration.MEDIA_ACTION_BOTH != mediaAction) {
mediaActionSwitchView.setVisibility(GONE);
}
//去掉Media Switch
else mediaActionSwitchView.setVisibility(GONE);
recordButton.setRecordState(RecordButton.READY_FOR_RECORD_STATE);
}
示例8: getVideoQualityOptions
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
@Override
protected CharSequence[] getVideoQualityOptions() {
List<CharSequence> videoQualities = new ArrayList<>();
if (getMinimumVideoDuration() > 0)
videoQualities.add(new VideoQualityOption(CameraConfiguration.MEDIA_QUALITY_AUTO, CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_AUTO, getCameraController().getCurrentCameraId()), getMinimumVideoDuration()));
CamcorderProfile camcorderProfile = CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_HIGH, getCameraController().getCurrentCameraId());
double videoDuration = CameraHelper.calculateApproximateVideoDuration(camcorderProfile, getVideoFileSize());
videoQualities.add(new VideoQualityOption(CameraConfiguration.MEDIA_QUALITY_HIGH, camcorderProfile, videoDuration));
camcorderProfile = CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_MEDIUM, getCameraController().getCurrentCameraId());
videoDuration = CameraHelper.calculateApproximateVideoDuration(camcorderProfile, getVideoFileSize());
videoQualities.add(new VideoQualityOption(CameraConfiguration.MEDIA_QUALITY_MEDIUM, camcorderProfile, videoDuration));
camcorderProfile = CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_LOW, getCameraController().getCurrentCameraId());
videoDuration = CameraHelper.calculateApproximateVideoDuration(camcorderProfile, getVideoFileSize());
videoQualities.add(new VideoQualityOption(CameraConfiguration.MEDIA_QUALITY_LOW, camcorderProfile, videoDuration));
CharSequence[] array = new CharSequence[videoQualities.size()];
videoQualities.toArray(array);
return array;
}
示例9: setCameraPhotoQuality
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
private void setCameraPhotoQuality(Camera camera) {
Camera.Parameters parameters = camera.getParameters();
parameters.setPictureFormat(PixelFormat.JPEG);
if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_LOW) {
parameters.setJpegQuality(50);
} else if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_MEDIUM) {
parameters.setJpegQuality(75);
} else if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_HIGH) {
parameters.setJpegQuality(100);
} else if (configurationProvider.getMediaQuality() == CameraConfiguration.MEDIA_QUALITY_HIGHEST) {
parameters.setJpegQuality(100);
}
parameters.setPictureSize(photoSize.getWidth(), photoSize.getHeight());
camera.setParameters(parameters);
}
示例10: launchIntent
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
private void launchIntent() {
if (CameraHelper.hasCamera(mActivity)) {
Intent cameraIntent;
if (CameraHelper.hasCamera2(mActivity)) {
cameraIntent = new Intent(mActivity, Camera2Activity.class);
} else {
cameraIntent = new Intent(mActivity, Camera1Activity.class);
}
cameraIntent.putExtra(CameraConfiguration.Arguments.SHOW_PICKER, showPicker);
cameraIntent.putExtra(CameraConfiguration.Arguments.PICKER_TYPE, type);
cameraIntent.putExtra(CameraConfiguration.Arguments.MEDIA_ACTION, mediaAction);
cameraIntent.putExtra(CameraConfiguration.Arguments.ENABLE_CROP, enableImageCrop);
cameraIntent.putExtra(CameraConfiguration.Arguments.AUTO_RECORD, autoRecord);
if (videoSize > 0) {
cameraIntent.putExtra(CameraConfiguration.Arguments.VIDEO_FILE_SIZE, videoSize * 1024 * 1024);
}
mActivity.startActivity(cameraIntent);
}
}
示例11: getOutputMediaFile
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
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;
}
示例12: getVideoQualityOptions
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
@Override
protected CharSequence[] getVideoQualityOptions() {
List<CharSequence> videoQualities = new ArrayList<>();
if (getMinimumVideoDuration() > 0)
videoQualities.add(new VideoQualityOption(CameraConfiguration.MEDIA_QUALITY_AUTO, CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_AUTO, getCameraController().getCurrentCameraId()), getMinimumVideoDuration()));
CamcorderProfile camcorderProfile = CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_HIGH, getCameraController().getCurrentCameraId());
double videoDuration = CameraHelper.calculateApproximateVideoDuration(camcorderProfile, getVideoFileSize());
videoQualities.add(new VideoQualityOption(CameraConfiguration.MEDIA_QUALITY_HIGH, camcorderProfile, videoDuration));
camcorderProfile = CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_MEDIUM, getCameraController().getCurrentCameraId());
videoDuration = CameraHelper.calculateApproximateVideoDuration(camcorderProfile, getVideoFileSize());
videoQualities.add(new VideoQualityOption(CameraConfiguration.MEDIA_QUALITY_MEDIUM, camcorderProfile, videoDuration));
camcorderProfile = CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_LOW, getCameraController().getCurrentCameraId());
videoDuration = CameraHelper.calculateApproximateVideoDuration(camcorderProfile, getVideoFileSize());
videoQualities.add(new VideoQualityOption(CameraConfiguration.MEDIA_QUALITY_LOW, camcorderProfile, videoDuration));
CharSequence[] array = new CharSequence[videoQualities.size()];
videoQualities.toArray(array);
return array;
}
示例13: onActivityResult
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == GET_PHOTO && resultCode == RESULT_OK) {
Log.e("File", "" + data.getStringExtra(CameraConfiguration.Arguments.FILE_PATH));
sendPhotoFirebase( data.getStringExtra(CameraConfiguration.Arguments.FILE_PATH) );
}
}
示例14: getPhoto
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
private void getPhoto(){
new SandriosCamera(MainActivity.this, GET_PHOTO)
.setShowPicker(false)
.setMediaAction(CameraConfiguration.MEDIA_ACTION_PHOTO)
.enableImageCropping(true)
.launchCamera();
}
示例15: launchCamera
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration; //导入依赖的package包/类
private void launchCamera(){
new SandriosCamera(activity, CAPTURE_MEDIA)
.setShowPicker(false)
.setMediaAction(CameraConfiguration.MEDIA_ACTION_BOTH)
.enableImageCropping(false)
.launchCamera();
}