From 2218b47975eb36be4cb106ce5afd1c053ac650aa Mon Sep 17 00:00:00 2001 From: Schoumi Date: Wed, 19 Apr 2017 18:36:14 +0200 Subject: [PATCH] Fix bug that don't allow simple selection on recent device --- .../java/fr/mobdev/goblim/activity/UploadActivity.java | 7 +++++-- build.gradle | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java b/app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java index f36cfc9..dfd1bb8 100644 --- a/app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java +++ b/app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java @@ -525,13 +525,16 @@ public class UploadActivity extends AppCompatActivity { public void onActivityResult(int requestCode, int resultCode,Intent returnIntent) { if(resultCode == RESULT_OK){ //retrieve uri from the request image activity and prepare - if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { + ClipData clip = null; + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) + clip = returnIntent.getClipData(); + + if(clip == null) { Uri imageUri = returnIntent.getData(); uris.add(imageUri); updateSpanCount(); adapter.addUri(this,imageUri); } else { - ClipData clip = returnIntent.getClipData(); for(int i = 0; clip != null && i < clip.getItemCount(); i++) { Uri imageUri = clip.getItemAt(i).getUri(); uris.add(imageUri); diff --git a/build.gradle b/build.gradle index 1ea4bd0..b78a0b8 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0' + classpath 'com.android.tools.build:gradle:2.3.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files