use of com.connxun.ltcx.entity.PostMessageImageItem in project ttdj by soonphe.
the class PublishGoodsFragment method compressWithLs.
/**
* Luban压缩图片 Listener 方式
*/
private void compressWithLs(final List<String> photos) {
Luban.with(this.getContext()).load(photos).ignoreBy(100).setTargetDir(getContext().getExternalFilesDir(DIRECTORY_PICTURES).getAbsolutePath()).setCompressListener(new OnCompressListener() {
@Override
public void onStart() {
}
@Override
public void onSuccess(File file) {
// 将选择的文件放入集合中
if (fileList != null) {
fileList.add(file);
} else {
fileList = new ArrayList<>();
fileList.add(file);
}
// compressPicList.add(file);
LogUtils.e("当前图片信息:" + file.getPath() + "当前图片大小:" + file.length());
LogUtils.e("要加载的图片路径:" + file.getAbsolutePath());
gridViewData.add(new PostMessageImageItem(file.getAbsolutePath()));
gridadapter.notifyDataSetChanged();
if (picList.size() == compressPicList.size()) {
// 图片上传
LogUtils.e("______图片压缩完毕", "图片list信息:" + compressPicList.size() + "--" + picList.size());
}
}
@Override
public void onError(Throwable e) {
LogUtils.e("______图片压缩失败" + e.toString());
}
}).launch();
}
Aggregations