Fetch the repository succeeded.
This action will force synchronization from 山野羡民/AndroidPicker, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
图片选择(相机+相册+裁剪),改自 ImagePicker 及 Android-Image-Cropper 。
注意合规性,允许APP使用摄像头,允许APP读取/写入外置存储器,调用之前要确保已获得用户授予CAMERA
、READ_EXTERNAL_STORAGE
、WRITE_EXTERNAL_STORAGE
权限。
public class ImagePickerActivity extends FragmentActivity {
private final PickCallback cropCallback = new PickCallback() {
@Override
public void onPermissionDenied(String[] permissions, String message) {
Toast.makeText(ImagePickerActivity.this, message, Toast.LENGTH_SHORT).show();
}
@Override
public void cropConfig(ActivityBuilder builder) {
builder.setMultiTouchEnabled(true)
.setGuidelines(CropImageView.Guidelines.ON_TOUCH)
.setCropShape(CropImageView.CropShape.OVAL)
.setRequestedSize(400, 400)
.setFixAspectRatio(true)
.setAspectRatio(1, 1);
}
@Override
public void onCropImage(@Nullable Uri imageUri) {
Toast.makeText(ImagePickerActivity.this, String.valueOf(imageUri), Toast.LENGTH_SHORT).show();
}
};
public void onCamera(View view) {
ImagePicker.getInstance().startCamera(this, true, cropCallback);
}
public void onGallery(View view) {
ImagePicker.getInstance().startGallery(this, true, cropCallback);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ImagePicker.getInstance().onActivityResult(this, requestCode, resultCode, data);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
ImagePicker.getInstance().onRequestPermissionsResult(this, requestCode, permissions, grantResults);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。