图片选择器--AndroidImagePicker
imagePickerhttps://github.com/easonline/AndroidImagePickeran imagePicker for android ,with it,you can select single or multiple image,crop it for avatar,take a photo and use it,preview
·
imagePicker
https://github.com/easonline/AndroidImagePicker
an imagePicker for android ,with it,you can select single or multiple image,crop it for avatar,take a photo and use it,preview and zoom etc.
Features
- choosing single or multi image with preview
- crop a image for avatar simply
- custom new version easily.
- easily use
Usage
just 1 minutes using it,and make your own version as you need.
Gradle
dependencies {
compile project(':imagepickerModule')
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3' //optional
compile 'com.github.bumptech.glide:glide:3.6.1' //optional
compile 'com.squareup.picasso:picasso:2.4.0' //optional
}
//single select
AndroidImagePicker.getInstance().pickSingle(MainActivity.this, isShowCamera, new AndroidImagePicker.OnImagePickCompleteListener() {
@Override
public void onImagePickComplete(List<ImageItem> items) {
if(items != null && items.size() > 0){
Log.i(TAG,"=====selected:"+items.get(0).path);
mAdapter.clear();
mAdapter.addAll(items);
}
}
});
//multi select
AndroidImagePicker.getInstance().pickMulti(MainActivity.this, isShowCamera, new AndroidImagePicker.OnImagePickCompleteListener() {
@Override
public void onImagePickComplete(List<ImageItem> items) {
if(items != null && items.size() > 0){
Log.i(TAG,"=====selected:"+items.get(0).path);
mAdapter.clear();
mAdapter.addAll(items);
}
}
});
//select and crop avatar
AndroidImagePicker.getInstance().pickAndCrop(MainActivity.this, true, 120, new AndroidImagePicker.OnImageCropCompleteListener() {
@Override
public void onImageCropComplete(Bitmap bmp, float ratio) {
Log.i(TAG,"=====onImageCropComplete (get bitmap="+bmp.toString());
ivCrop.setVisibility(View.VISIBLE);
ivCrop.setImageBitmap(bmp);
}
});
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献1条内容
所有评论(0)