mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Change requestPermissions() call
This commit is contained in:
parent
50771ea1ec
commit
635deea78e
1 changed files with 3 additions and 1 deletions
|
|
@ -114,7 +114,8 @@ public class ContributionsListFragment extends Fragment {
|
||||||
//Gallery crashes before reach ShareActivity screen so must implement permissions check here
|
//Gallery crashes before reach ShareActivity screen so must implement permissions check here
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
if (ContextCompat.checkSelfPermission(this.getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
if (ContextCompat.checkSelfPermission(this.getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
ActivityCompat.requestPermissions(this.getActivity(), new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
|
//See http://stackoverflow.com/questions/33169455/onrequestpermissionsresult-not-being-called-in-dialog-fragment
|
||||||
|
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
controller.startGalleryPick();
|
controller.startGalleryPick();
|
||||||
|
|
@ -164,6 +165,7 @@ public class ContributionsListFragment extends Fragment {
|
||||||
// 1 = Storage allowed when gallery selected
|
// 1 = Storage allowed when gallery selected
|
||||||
case 1: {
|
case 1: {
|
||||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
Log.d("ContributionsList", "Call controller.startGalleryPick()");
|
||||||
controller.startGalleryPick();
|
controller.startGalleryPick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue