RxPicker

½éÉÜ£º

»ùÓÚ RxJava µÄ Android ͼƬѡÔñÆ÷.

ÔËÐÐЧ¹û£º

ʹÓÃ˵Ã÷£º

ÌØÕ÷

  1. Óë RxJava ½áºÏ,Ö§³ÖÏìӦʽµÃµ½Ñ¡ÔñͼƬ½á¹û

  2. ¼æÈÝ Android 7.0

  3. ×Ô¶¨Òå ImageLoader

1.Ìí¼Ó gradle ÒýÓÃ

compile 'com.caimuhao:rxpicker:1.1.4'

2.¼Ì³Ð RxPickerImageLoader ´´½¨×Ô¶¨ÒåµÄͼƬ¼ÓÔØ

public class GlideImageLoader implements RxPickerImageLoader {
  @Override public void display(ImageView imageView, String path, int width, int height) {
    Glide.with(imageView.getContext())
        .load(path)
        .error(R.drawable.ic_preview_image)
        .centerCrop()
        .override(width, height)
        .into(imageView);
  }
}

3.³õʼ»¯ RxPicker

RxPicker.init(new GlideImageLoader());

4.ʹÓÃ

  • ͼƬµ¥Ñ¡
RxPicker.of().start(this).subscribe(new Consumer<List<ImageItem>>() {
        @Override public void accept(@NonNull List<ImageItem> imageItems) throws Exception {
          //µÃµ½½á¹û
        }
      });
  • ͼƬ¶àÑ¡
RxPicker.of()
          .single(false)
          .camera(true)
          .limit(3,9)
          .start(this)
          .subscribe(new Consumer<List<ImageItem>>() {
            @Override public void accept(@NonNull List<ImageItem> imageItems) throws Exception {
              //µÃµ½½á¹û
            }
          });

2.png

已下载
0