Commit 8b9b812c authored by wanglei's avatar wanglei

修改安卓6+拍照使用不了的问题

parent 07b3bc6e
...@@ -17,7 +17,7 @@ android { ...@@ -17,7 +17,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 22 targetSdkVersion 23
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
} }
...@@ -32,6 +32,6 @@ repositories { ...@@ -32,6 +32,6 @@ repositories {
dependencies { dependencies {
compile 'com.facebook.react:react-native:+' compile 'com.facebook.react:react-native:+'
compile 'com.github.LuckSiege.PictureSelector:picture_library:v2.1.1' compile 'com.github.LuckSiege.PictureSelector:picture_library:v2.1.7'
} }
\ No newline at end of file
...@@ -87,29 +87,38 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule { ...@@ -87,29 +87,38 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule {
} }
Activity currentActivity = getCurrentActivity(); Activity currentActivity = getCurrentActivity();
PictureSelector.create(currentActivity) PictureSelector.create(currentActivity)
.openGallery(PictureMimeType.ofImage())// 全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()、音频.ofAudio() .openGallery(PictureMimeType.ofImage())//全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()、音频.ofAudio()
.maxSelectNum(imageCount)// 最大图片选择数量 .maxSelectNum(imageCount)// 最大图片选择数量 int
.minSelectNum(1)// 最小选择数量 .minSelectNum(1)// 最小选择数量 int
.imageSpanCount(4)// 每行显示个数 .imageSpanCount(4)// 每行显示个数 int
.selectionMode(modeValue)// 多选 or 单选 .selectionMode(modeValue)// 多选 or 单选 PictureConfig.MULTIPLE or PictureConfig.SINGLE
.previewImage(true)// 是否可预览图片 .previewImage(true)// 是否可预览图片 true or false
.previewVideo(false)// 是否可预览视频 .previewVideo(false)// 是否可预览视频 true or false
.compressGrade(Luban.THIRD_GEAR)// luban压缩档次,默认3档 Luban.FIRST_GEAR、Luban.CUSTOM_GEAR .enablePreviewAudio(false) // 是否可播放音频 true or false
.isCamera(isCamera)// 是否显示拍照按钮 .isCamera(isCamera)// 是否显示拍照按钮 true or false
.enableCrop(isCrop)// 是否裁剪 .imageFormat(PictureMimeType.PNG)// 拍照保存图片格式后缀,默认jpeg
.compress(true)// 是否压缩 .isZoomAnim(true)// 图片列表点击 缩放效果 默认true
.compressMode(PictureConfig.SYSTEM_COMPRESS_MODE)//系统自带 or 鲁班压缩 PictureConfig.SYSTEM_COMPRESS_MODE or LUBAN_COMPRESS_MODE .sizeMultiplier(0.5f)// glide 加载图片大小 0~1之间 如设置 .glideOverride()无效
.glideOverride(160, 160)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度 .enableCrop(isCrop)// 是否裁剪 true or false
.withAspectRatio(CropW, CropH)// 裁剪比例 如16:9 3:2 3:4 1:1 可自定义 裁剪比例自定义 .compress(true)// 是否压缩 true or false
.hideBottomControls(isCrop)// 是否显示uCrop工具栏,默认不显示 .glideOverride(160, 160)// int glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
.isGif(isGif)// 是否显示gif图片 .withAspectRatio(CropW, CropH)// int 裁剪比例 如16:9 3:2 3:4 1:1 可自定义
.freeStyleCropEnabled(true)// 裁剪框是否可拖拽 .hideBottomControls(isCrop)// 是否显示uCrop工具栏,默认不显示 true or false
.circleDimmedLayer(showCropCircle)// 是否圆形裁剪 .isGif(isGif)// 是否显示gif图片 true or false
.showCropFrame(showCropFrame)// 是否显示裁剪矩形边框 圆形裁剪时建议设为false .freeStyleCropEnabled(true)// 裁剪框是否可拖拽 true or false
.showCropGrid(showCropGrid)// 是否显示裁剪矩形网格 圆形裁剪时建议设为false .circleDimmedLayer(showCropCircle)// 是否圆形裁剪 true or false
.openClickSound(false)// 是否开启点击声音 .showCropFrame(showCropFrame)// 是否显示裁剪矩形边框 圆形裁剪时建议设为false true or false
.cropCompressQuality(90)// 裁剪压缩质量 默认100 .showCropGrid(showCropGrid)// 是否显示裁剪矩形网格 圆形裁剪时建议设为false true or false
.scaleEnabled(true)// 裁剪是否可放大缩小图片 .openClickSound(false)// 是否开启点击声音 true or false
.cropCompressQuality(90)// 裁剪压缩质量 默认90 int
.minimumCompressSize(100)// 小于100kb的图片不压缩
.synOrAsy(true)//同步true或异步false 压缩 默认同步
.rotateEnabled(true) // 裁剪是否可旋转图片 true or false
.scaleEnabled(true)// 裁剪是否可放大缩小图片 true or false
.videoQuality(0)// 视频录制质量 0 or 1 int
.videoMaxSecond(15)// 显示多少秒以内的视频or音频也可适用 int
.videoMinSecond(10)// 显示多少秒以内的视频or音频也可适用 int
.recordVideoSecond(60)//视频秒数录制 默认60s int
.forResult(PictureConfig.CHOOSE_REQUEST);//结果回调onActivityResult code .forResult(PictureConfig.CHOOSE_REQUEST);//结果回调onActivityResult code
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment