|
|
@@ -57,13 +57,13 @@ public class OperationPresenter extends BasePresenter<IOperationView> {
|
|
|
String photoBase64 = null;
|
|
|
// 这个如果是竖屏拍的照片,需要顺时针旋转90度才正常
|
|
|
Bitmap rawBitmap = ImageUtil.getBitmapFromUri(context, uri);
|
|
|
- String filePath = ImageOrientation.getPath(context, uri);
|
|
|
- MediaScannerConnection.scanFile(context, new String[] { filePath }, new String[] { "image/jpeg" }, null);
|
|
|
+ String rawFilePath = ImageOrientation.getPath(context, uri);
|
|
|
+ MediaScannerConnection.scanFile(context, new String[] { rawFilePath }, new String[] { "image/jpeg" }, null);
|
|
|
|
|
|
// 肉眼看见的Bitmap
|
|
|
Bitmap viewedBitmap = rawBitmap;
|
|
|
- if (!TextUtils.isEmpty(filePath) && !isFromRawCamera) {
|
|
|
- viewedBitmap = ImageOrientation.modifyOrientation(filePath, rawBitmap);
|
|
|
+ if (!TextUtils.isEmpty(rawFilePath) && !isFromRawCamera) {
|
|
|
+ viewedBitmap = ImageOrientation.modifyOrientation(rawFilePath, rawBitmap);
|
|
|
}
|
|
|
|
|
|
if (viewedBitmap == null) {
|
|
|
@@ -121,17 +121,20 @@ public class OperationPresenter extends BasePresenter<IOperationView> {
|
|
|
|
|
|
//从相册选择图片上传的话,不要删除原图
|
|
|
// 通知相册去获取
|
|
|
+ File rawFile = new File(rawFilePath);
|
|
|
if (file != compressedFile) {
|
|
|
file.delete();
|
|
|
- if (!filePath.contains("cache")) {
|
|
|
+ if (!rawFilePath.contains("cache")) {
|
|
|
compressedFile.delete();
|
|
|
} else {
|
|
|
+ rawFile.delete();
|
|
|
MediaScannerConnection.scanFile(context, new String[] { compressedFile.getAbsolutePath() }, new String[] { "image/jpeg" }, null);
|
|
|
}
|
|
|
} else {
|
|
|
- if (!filePath.contains("cache")) {
|
|
|
+ if (!rawFilePath.contains("cache")) {
|
|
|
file.delete();
|
|
|
} else {
|
|
|
+ rawFile.delete();
|
|
|
MediaScannerConnection.scanFile(context, new String[] { file.getAbsolutePath() }, new String[] { "image/jpeg" }, null);
|
|
|
}
|
|
|
}
|