|
@@ -185,30 +185,30 @@ public class OtaCameraActivity extends BaseCameraActivity {
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean mIsRawOpen = false;
|
|
private boolean mIsRawOpen = false;
|
|
|
- private File tempRawPhotoFile;
|
|
|
|
|
|
|
+ private File mTempRawPhotoFile;
|
|
|
// 保存拍照的路径
|
|
// 保存拍照的路径
|
|
|
- private Uri mImageCaptureUri;
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 打开原生相机
|
|
|
|
|
|
|
+ * 适配OPPO Find X和部分机型拍照不清晰的问题,打开原生相机
|
|
|
*/
|
|
*/
|
|
|
private void openRawCamera() {
|
|
private void openRawCamera() {
|
|
|
if (mIsRawOpen) {
|
|
if (mIsRawOpen) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
mIsRawOpen = true;
|
|
mIsRawOpen = true;
|
|
|
- tempRawPhotoFile = new File(Environment.getExternalStoragePublicDirectory(DIRECTORY_PICTURES) + "/" + System.currentTimeMillis() + ".jpg");
|
|
|
|
|
- if (!tempRawPhotoFile.getParentFile().exists()) {
|
|
|
|
|
- tempRawPhotoFile.getParentFile().mkdirs();
|
|
|
|
|
|
|
+ mTempRawPhotoFile = new File(Environment.getExternalStoragePublicDirectory(DIRECTORY_PICTURES) + "/" + System.currentTimeMillis() + ".jpg");
|
|
|
|
|
+ if (!mTempRawPhotoFile.getParentFile().exists()) {
|
|
|
|
|
+ mTempRawPhotoFile.getParentFile().mkdirs();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 跳转系统相机的intent
|
|
// 跳转系统相机的intent
|
|
|
Intent takeIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
Intent takeIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
|
|
|
+ Uri mImageCaptureUri;
|
|
|
// 根据不同的Android版本uri不一样
|
|
// 根据不同的Android版本uri不一样
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
|
//android7.0以上
|
|
//android7.0以上
|
|
|
- mImageCaptureUri = getNewUri(tempRawPhotoFile);
|
|
|
|
|
|
|
+ mImageCaptureUri = getNewUri(mTempRawPhotoFile);
|
|
|
} else {
|
|
} else {
|
|
|
- mImageCaptureUri = Uri.fromFile(tempRawPhotoFile);
|
|
|
|
|
|
|
+ mImageCaptureUri = Uri.fromFile(mTempRawPhotoFile);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
takeIntent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
|
|
takeIntent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
|
|
@@ -230,8 +230,8 @@ public class OtaCameraActivity extends BaseCameraActivity {
|
|
|
if (requestCode == REQUEST_CODE_RAW_CAMERA) {
|
|
if (requestCode == REQUEST_CODE_RAW_CAMERA) {
|
|
|
//correctPhotoRotation(tempRawPhotoFile, mImageCaptureUri);
|
|
//correctPhotoRotation(tempRawPhotoFile, mImageCaptureUri);
|
|
|
// 通知相册去获取
|
|
// 通知相册去获取
|
|
|
- MediaScannerConnection.scanFile(this, new String[] { tempRawPhotoFile.getAbsolutePath() }, new String[] { "image/jpeg" }, null);
|
|
|
|
|
- cropPhoto(tempRawPhotoFile, getNewUri(tempRawPhotoFile));
|
|
|
|
|
|
|
+ MediaScannerConnection.scanFile(this, new String[] { mTempRawPhotoFile.getAbsolutePath() }, new String[] { "image/jpeg" }, null);
|
|
|
|
|
+ cropPhoto(mTempRawPhotoFile, getNewUri(mTempRawPhotoFile));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
|
|
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
|