Skip to content

Commit

Permalink
test compression switch
Browse files Browse the repository at this point in the history
  • Loading branch information
郑梓斌 committed May 12, 2018
1 parent fc07eec commit f4c57ee
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion example/src/main/java/top/zibin/luban/example/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;

Expand All @@ -23,6 +24,7 @@
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import me.iwf.photopicker.PhotoPicker;
import top.zibin.luban.CompressionPredicate;
import top.zibin.luban.Luban;
import top.zibin.luban.OnCompressListener;

Expand Down Expand Up @@ -85,7 +87,15 @@ private void compressWithRx(final List<String> photos) {
.map(new Function<List<String>, List<File>>() {
@Override
public List<File> apply(@NonNull List<String> list) throws Exception {
return Luban.with(MainActivity.this).load(list).get();
return Luban.with(MainActivity.this)
.load(list)
.filter(new CompressionPredicate() {
@Override
public boolean apply(String path) {
return !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif"));
}
})
.get();
}
})
.observeOn(AndroidSchedulers.mainThread())
Expand Down

0 comments on commit f4c57ee

Please sign in to comment.