use of top.zibin.luban.CompressionPredicate in project Luban by Curzibn.
the class MainActivity method withLs.
private <T> void withLs(final List<T> photos) {
Luban.with(this).load(photos).ignoreBy(100).setTargetDir(getPath()).setFocusAlpha(false).filter(new CompressionPredicate() {
@Override
public boolean apply(String path) {
return !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif"));
}
}).setRenameListener(new OnRenameListener() {
@Override
public String rename(String filePath) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(filePath.getBytes());
return new BigInteger(1, md.digest()).toString(32);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}
}).setCompressListener(new OnCompressListener() {
@Override
public void onStart() {
}
@Override
public void onSuccess(File file) {
Log.i(TAG, file.getAbsolutePath());
showResult(originPhotos, file);
}
@Override
public void onError(Throwable e) {
}
}).launch();
}
Aggregations