@@ -44,13 +44,18 @@ public LiveData<List<GalleryModel>> getGalleryMediaList(String selection, String
4444 if (galleryList ==null ){
4545 galleryList =new MutableLiveData <>();
4646 }
47+ String extraQuery =MediaStore .Files .FileColumns .DATA +" NOT LIKE '%Android/%' " ;
48+ selection = TextUtils .isEmpty (selection ) ? extraQuery
49+ : selection +" AND " +extraQuery ;
50+
51+ String finalSelection = selection ;
4752 mExecutorService .execute (()->{
4853 // <editor-fold defaultstate="collapsed" desc=" Images ">
4954 String [] imageProjection = {MediaStore .Images .Media ._ID ,
5055 MediaStore .Images .Media .DATA , MediaStore .Images .Media .DATE_ADDED ,
5156 MediaStore .Images .Media .DISPLAY_NAME , MediaStore .Images .Media .MIME_TYPE };
5257 Cursor externalImageCursor = mContentResolver .query (MediaStore .Images .Media .EXTERNAL_CONTENT_URI , imageProjection ,
53- selection , selectionArgs , MediaStore .Images .Media .DATE_ADDED + " DESC" );
58+ finalSelection , selectionArgs , MediaStore .Images .Media .DATE_ADDED + " DESC" );
5459 List <GalleryModel > galleryModelList = new ArrayList <>(getGalleryModel (externalImageCursor , imageProjection ));
5560 // </editor-fold>
5661
@@ -60,7 +65,7 @@ public LiveData<List<GalleryModel>> getGalleryMediaList(String selection, String
6065 MediaStore .Video .Media .DATA , MediaStore .Video .Media .DATE_ADDED ,
6166 MediaStore .Video .Media .DISPLAY_NAME , MediaStore .Video .Media .MIME_TYPE };
6267 Cursor externalVideoCursor = mContentResolver .query (MediaStore .Video .Media .EXTERNAL_CONTENT_URI , videoProjection ,
63- selection , selectionArgs , MediaStore .Video .Media .DATE_ADDED + " DESC" );
68+ finalSelection , selectionArgs , MediaStore .Video .Media .DATE_ADDED + " DESC" );
6469 galleryModelList .addAll (getGalleryModel (externalVideoCursor , videoProjection ));
6570 }
6671 // </editor-fold>
0 commit comments