From 08d1970de71cf1fa91b591fdbe832e9892979c95 Mon Sep 17 00:00:00 2001 From: Glebov Sergey Date: Thu, 18 Aug 2016 11:59:44 +0300 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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' } ``` From b10033d50798df022910a724e2a4459e76cb0c45 Mon Sep 17 00:00:00 2001 From: "s.zabelnikov" Date: Fri, 17 Feb 2017 09:37:34 +0200 Subject: [PATCH 2/2] Added handling of camera permission --- .../mlsdev/rximagepicker/HiddenActivity.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/library/src/main/java/com/mlsdev/rximagepicker/HiddenActivity.java b/library/src/main/java/com/mlsdev/rximagepicker/HiddenActivity.java index 4bab648..d957c62 100644 --- a/library/src/main/java/com/mlsdev/rximagepicker/HiddenActivity.java +++ b/library/src/main/java/com/mlsdev/rximagepicker/HiddenActivity.java @@ -13,7 +13,6 @@ import android.provider.MediaStore; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; -import android.util.Log; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -118,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); @@ -134,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; @@ -153,4 +155,4 @@ private Uri createImageUri() { return contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, cv); } -} \ No newline at end of file +}