场景一:类似于发朋友圈上传图片:不涉及裁剪图片
ImageSelectProxyActivity.selectImage(ImageActivity.this, UsageTypeConstant.OTHER, 9);
场景二:更换头像:裁剪图片
ImageSelectProxyActivity.selectImage(ImageActivity.this, UsageTypeConstant.HEAD_PORTRAIT, 1);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (RESULT_OK == resultCode) {
if (requestCode == ImageConstant.REQUEST_CODE_IAMGES) {
ArrayList<String> list = (ArrayList<String>) data.getSerializableExtra(ImageConstant.SELECTED_IAMGES);
//场景一:发朋友圈上传、评论等上传 这里不裁剪
if (mType.equals(UsageTypeConstant.OTHER)) {
mImagesAdapter.updateDataFromAlbum(list);
}
if (mType.equals(UsageTypeConstant.HEAD_PORTRAIT)) {
//场景二:头像等上传 有裁剪操作
if (list != null && list.size() > 0) {
GlideApp.with(this).load(list.get(0)).circleCrop().into(mIv_logo);
}
}
}
}
}
拍照适配最新的7.0和8.0,不同版本区分直接的uri和封装后的uri(fileProvider);