Skip to content

Commit

Permalink
Merge pull request #24 from HuanTanSheng/dev
Browse files Browse the repository at this point in the history
DEV
  • Loading branch information
HuanTanSheng authored Feb 3, 2018
2 parents 4ca88b4 + 120b13c commit 569971a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ private void toAndroidCamera(int requestCode) {
createCameraTempImageFile();
if (mTempImageFile != null && mTempImageFile.exists()) {

Uri imageUri = FileProvider.getUriForFile(this, Setting.fileProviderAuthority, mTempImageFile);//通过FileProvider创建一个content类型的Uri
Uri imageUri = null;
if (Build.VERSION.SDK_INT >= 24) {
imageUri = FileProvider.getUriForFile(this, Setting.fileProviderAuthority, mTempImageFile);//通过FileProvider创建一个content类型的Uri
} else {
imageUri = Uri.fromFile(mTempImageFile);
}
cameraIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); //对目标应用临时授权该Uri所代表的文件

cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);//将拍取的照片保存到指定URI
Expand Down Expand Up @@ -388,7 +393,7 @@ private void onCameraResult() {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(mTempImageFile.getAbsolutePath(), options);
if (Setting.onlyStartCamera||albumModel.getAlbumItems().isEmpty()) {
if (Setting.onlyStartCamera || albumModel.getAlbumItems().isEmpty()) {
MediaScannerConnectionUtils.refresh(this, mTempImageFile);// 更新媒体库
Intent data = new Intent();
Photo photo = new Photo(mTempImageFile.getName(), mTempImageFile.getAbsolutePath(), mTempImageFile.lastModified() / 1000, options.outWidth, options.outHeight, mTempImageFile.length(), options.outMimeType);
Expand Down

0 comments on commit 569971a

Please sign in to comment.