diff --git a/imagepicker/build.gradle b/imagepicker/build.gradle index d5952b04..f25d79ec 100644 --- a/imagepicker/build.gradle +++ b/imagepicker/build.gradle @@ -3,6 +3,8 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'com.github.dcendents.android-maven' +group = 'com.github.ZupersoftSolutions' + android { final sdk = rootProject.ext.sdk diff --git a/imagepicker/src/main/java/com/esafirm/imagepicker/features/fileloader/DefaultImageFileLoader.java b/imagepicker/src/main/java/com/esafirm/imagepicker/features/fileloader/DefaultImageFileLoader.java index 990d1d5a..c0269062 100644 --- a/imagepicker/src/main/java/com/esafirm/imagepicker/features/fileloader/DefaultImageFileLoader.java +++ b/imagepicker/src/main/java/com/esafirm/imagepicker/features/fileloader/DefaultImageFileLoader.java @@ -30,30 +30,30 @@ public DefaultImageFileLoader(Context context) { } private final String[] projection = new String[]{ - MediaStore.Images.Media._ID, - MediaStore.Images.Media.DISPLAY_NAME, - MediaStore.Images.Media.DATA, - MediaStore.Images.Media.BUCKET_DISPLAY_NAME + MediaStore.Images.Media._ID, + MediaStore.Images.Media.DISPLAY_NAME, + MediaStore.Images.Media.DATA, + MediaStore.Images.Media.BUCKET_DISPLAY_NAME }; @Override public void loadDeviceImages( - final boolean isFolderMode, - final boolean onlyVideo, - final boolean includeVideo, - final boolean includeAnimation, - final ArrayList excludedImages, - final ImageLoaderListener listener + final boolean isFolderMode, + final boolean onlyVideo, + final boolean includeVideo, + final boolean includeAnimation, + final ArrayList excludedImages, + final ImageLoaderListener listener ) { getExecutorService().execute( - new ImageLoadRunnable( - isFolderMode, - onlyVideo, - includeVideo, - includeAnimation, - excludedImages, - listener - )); + new ImageLoadRunnable( + isFolderMode, + onlyVideo, + includeVideo, + includeAnimation, + excludedImages, + listener + )); } @Override @@ -81,12 +81,12 @@ private class ImageLoadRunnable implements Runnable { private ImageLoaderListener listener; ImageLoadRunnable( - boolean isFolderMode, - boolean onlyVideo, - boolean includeVideo, - boolean includeAnimation, - ArrayList excludedImages, - ImageLoaderListener listener + boolean isFolderMode, + boolean onlyVideo, + boolean includeVideo, + boolean includeAnimation, + ArrayList excludedImages, + ImageLoaderListener listener ) { this.isFolderMode = isFolderMode; this.includeVideo = includeVideo; @@ -99,13 +99,13 @@ private class ImageLoadRunnable implements Runnable { private String getQuerySelection() { if (onlyVideo) { return MediaStore.Files.FileColumns.MEDIA_TYPE + "=" - + MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO; + + MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO; } if (includeVideo) { return MediaStore.Files.FileColumns.MEDIA_TYPE + "=" - + MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE + " OR " - + MediaStore.Files.FileColumns.MEDIA_TYPE + "=" - + MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO; + + MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE + " OR " + + MediaStore.Files.FileColumns.MEDIA_TYPE + "=" + + MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO; } return null; } @@ -120,7 +120,7 @@ private Uri getSourceUri() { @Override public void run() { Cursor cursor = context.getContentResolver().query(getSourceUri(), projection, - getQuerySelection(), null, MediaStore.Images.Media.DATE_ADDED); + getQuerySelection(), null, MediaStore.Images.Media.DATE_ADDED); if (cursor == null) { listener.onFailed(new NullPointerException()); @@ -156,17 +156,19 @@ public void run() { String name = cursor.getString(cursor.getColumnIndex(projection[1])); String bucket = cursor.getString(cursor.getColumnIndex(projection[3])); - Image image = new Image(id, name, path); + if (name != null && bucket != null) { + Image image = new Image(id, name, path); - temp.add(image); + temp.add(image); - if (folderMap != null) { - Folder folder = folderMap.get(bucket); - if (folder == null) { - folder = new Folder(bucket); - folderMap.put(bucket, folder); + if (folderMap != null) { + Folder folder = folderMap.get(bucket); + if (folder == null) { + folder = new Folder(bucket); + folderMap.put(bucket, folder); + } + folder.getImages().add(image); } - folder.getImages().add(image); } } while (cursor.moveToPrevious());