diff --git a/multilibrary/src/main/java/com/zhongjh/albumcamerarecorder/album/utils/AlbumCompressFileTask.kt b/multilibrary/src/main/java/com/zhongjh/albumcamerarecorder/album/utils/AlbumCompressFileTask.kt index 1ffe3394..7d82fc29 100644 --- a/multilibrary/src/main/java/com/zhongjh/albumcamerarecorder/album/utils/AlbumCompressFileTask.kt +++ b/multilibrary/src/main/java/com/zhongjh/albumcamerarecorder/album/utils/AlbumCompressFileTask.kt @@ -111,19 +111,13 @@ class AlbumCompressFileTask( fun handleImage(path: String): File { val oldFile = File(path) // 根据类型压缩 - var compressionFile: File - if (globalSpec.imageCompressionInterface != null) { - // 压缩图片 - try { - compressionFile = - globalSpec.imageCompressionInterface!!.compressionFile(context, oldFile) - } catch (e: IOException) { - compressionFile = oldFile - e.printStackTrace() + val compressionFile: File = + if (globalSpec.imageCompressionInterface != null) { + // 压缩图片 + globalSpec.imageCompressionInterface!!.compressionFile(context, oldFile) + } else { + oldFile } - } else { - compressionFile = oldFile - } return compressionFile } diff --git a/multilibrary/src/main/java/com/zhongjh/albumcamerarecorder/preview/BasePreviewActivity.java b/multilibrary/src/main/java/com/zhongjh/albumcamerarecorder/preview/BasePreviewActivity.java index 337f9776..aacfe89b 100644 --- a/multilibrary/src/main/java/com/zhongjh/albumcamerarecorder/preview/BasePreviewActivity.java +++ b/multilibrary/src/main/java/com/zhongjh/albumcamerarecorder/preview/BasePreviewActivity.java @@ -14,6 +14,7 @@ import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; +import android.widget.Toast; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; @@ -646,6 +647,7 @@ public void onSuccess(Void result) { @Override public void onFail(Throwable t) { super.onFail(t); + Toast.makeText(getApplicationContext(), t.getMessage(), Toast.LENGTH_SHORT).show(); Log.d(TAG, "getCompressFileTask onFail " + t.getMessage()); } };