//图片选择
implementation 'me.iwf.photopicker:PhotoPicker:0.9.10@aar'
//1 选择一张图片(用于头像选择)
PhotoPicker.builder()
.setPhotoCount(1)//只选择一张
.setShowCamera(true)//显示照相机
.setShowGif(true)//显示GIF
.setPreviewEnabled(false)//不是预览
.start(JobCVActivity.this, PICK_HEAD_PIC);
if (resultCode == RESULT_OK && requestCode == PICK_HEAD_PIC) {
List<String> photos = null;
if (data != null) {
photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
headPhotoPath = photos.get(0);
Glide.with(ApplyBlindDateActivity.this).load(photos.get(0)).into(cvBlindDataHeadpic);
}
}
//1 对图片进行展示(只展示,展示图片使用)
PhotoPreview.builder()
.setPhotos((ArrayList<String>) vcPicUrls)
.setShowDeleteButton(false)
.setCurrentItem(1)
.start(this);
//2对图片进行选择(只进行添加)
PhotoPicker.builder()
.setPhotoCount(count - (mData == null?0:mData.size()))
.setShowCamera(true)
.setShowGif(true)
.setPreviewEnabled(false)
.start((BaseActivity) mContext, PhotoPicker.REQUEST_CODE);
//3展示图片并可以进行删除(展示+删除)
PhotoPreview.builder()
.setPhotos(mData)
.setCurrentItem(position)
.start((BaseActivity) mContext);
if (resultCode == RESULT_OK && (requestCode == PhotoPicker.REQUEST_CODE || requestCode == PhotoPreview.REQUEST_CODE)) {
if (data != null) {
List<String> photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
if (requestCode == PhotoPreview.REQUEST_CODE) {
photoPaths.clear();
}
if (photos != null) {
photoPaths.addAll(photos);
}
addPicAdapter.setData(photoPaths);
// addPicAdapter.notifyDataSetChanged();
}
}