public void luBan(final List imgs) {
final List mImageUrlList =new ArrayList<>();
for (int i =0; i < imgs.size(); i++) {
File file =new File(imgs.get(i));
//压缩
Luban.with(getContext())
.load(file)
.setCompressListener(new OnCompressListener() {
@Override
public void onStart() {
// TODO 压缩开始前调用,可以在方法内启动 loading UI
}
@Override
public void onSuccess(File file) {
// TODO 压缩成功后调用,返回压缩后的图片文件
mImageUrlList.add(file.getAbsolutePath());
if (mImageUrlList.size() ==imgs.size()) {
// uploadDetailImgs(ImageUrlList);
ToastUtils.showToast(getContext(),"压缩成功");
CarLogUtils.debugLog(mImageUrlList);
}
}
@Override
public void onError(Throwable e) {
// TODO 当压缩过程出现问题时调用
}
}).launch();
}
// uploadDetailImgs(ImageUrlList);
}