Skip to content

Commit

Permalink
完善压缩的一些信息处理
Browse files Browse the repository at this point in the history
  • Loading branch information
aaatttcccc committed Mar 25, 2022
1 parent 436cb73 commit a5f018c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
};
Expand Down

0 comments on commit a5f018c

Please sign in to comment.