高仿Android版微信的图片和视频选择器。
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.xushihai:MediaPicker:v3.10'
}
GalleryFinal.selectMedias(this, 10, new GalleryFinal.OnSelectMediaListener() {
@Override
public void onSelected(ArrayList<Photo> photoArrayList) {
}
});
#新增gif图片标志
使用EventBus3.0注册,接收选择好的图片和视频列表
@Subscribe(threadMode = ThreadMode.MAIN)
public void sendMedia(ArrayList<Photo> photoList) {
Log.e("多媒体", photoList.toString());
}
GalleryFinal.selectMedias(this, 10);
GalleryFinal.captureMedia(this, Environment.getExternalStorageDirectory().getAbsolutePath(),10*1000);
使用EventBus3.0注册,接收拍摄好的图片或视频
@Subscribe(threadMode = ThreadMode.MAIN)
public void sendMedia(Photo media) {
}
GalleryFinal.captureMedia(this, Environment.getExternalStorageDirectory().getAbsolutePath(), new GalleryFinal.OnCaptureListener() {
@Override
public void onSelected(Photo photo) {
Log.e("拍摄","拍摄完成:"+photo);
}
});
使用了v7兼容包,EventBus,Glide,RecyclerView组件。如果项目中包含了这些组件可以使用exclude将这几个组件排除。
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'recyclerview-v7'
exclude group: 'org.greenrobot', module: 'eventbus'
exclude group: 'com.github.bumptech.glide', module: 'glide'
#混淆: #-keep class com.google.android.cameraview.CameraView{*;}