diff --git a/README.md b/README.md index 2457c4a..3cadc00 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ In your build.gradle : ```gradle dependencies { - compile 'com.mlsdev.rximagepicker:library:1.3.0' + compile 'com.mlsdev.rximagepicker:library:1.3.1' compile 'io.reactivex:rxjava:1.0.14' } ``` diff --git a/library/src/main/java/com/mlsdev/rximagepicker/HiddenActivity.java b/library/src/main/java/com/mlsdev/rximagepicker/HiddenActivity.java index b37555e..d957c62 100644 --- a/library/src/main/java/com/mlsdev/rximagepicker/HiddenActivity.java +++ b/library/src/main/java/com/mlsdev/rximagepicker/HiddenActivity.java @@ -117,7 +117,8 @@ private void handleIntent(Intent intent) { case GALLERY: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { pictureChooseIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT); - pictureChooseIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, getIntent().getBooleanExtra(ALLOW_MULTIPLE_IMAGES, false)); + pictureChooseIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, + getIntent().getBooleanExtra(ALLOW_MULTIPLE_IMAGES, false)); pictureChooseIntent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); } else { pictureChooseIntent = new Intent(Intent.ACTION_GET_CONTENT); @@ -133,11 +134,13 @@ private void handleIntent(Intent intent) { } private boolean checkPermission() { - if (ContextCompat.checkSelfPermission(HiddenActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != - PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(HiddenActivity.this, - new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, - 0); + if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) + != PackageManager.PERMISSION_GRANTED + || (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) + != PackageManager.PERMISSION_GRANTED)) { + + ActivityCompat.requestPermissions(this, + new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA}, 0); return false; } else { return true; @@ -152,4 +155,4 @@ private Uri createImageUri() { return contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, cv); } -} \ No newline at end of file +}