diff --git a/app/build.gradle b/app/build.gradle
index 0894159..b160916 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,12 +1,12 @@
 apply plugin: 'com.android.application'
 
 android {
-    compileSdkVersion 28
+    compileSdkVersion 29
     //buildToolsVersion "26.0.2"
     defaultConfig {
         applicationId "com.vincent.filepickersample"
         minSdkVersion 14
-        targetSdkVersion 28
+        targetSdkVersion 29
         versionCode 1
         versionName "1.0"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/build.gradle b/build.gradle
index 58563d4..51c4cd0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.5.3'
+        classpath 'com.android.tools.build:gradle:4.0.1'
         classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
         classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
         // NOTE: Do not place your application dependencies here; they belong
diff --git a/filepicker/build.gradle b/filepicker/build.gradle
index 0123a3b..d61a0d5 100644
--- a/filepicker/build.gradle
+++ b/filepicker/build.gradle
@@ -33,6 +33,11 @@ android {
     lintOptions {
         disable 'Deprecation'
     }
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+    buildToolsVersion '30.0.2'
 }
 
 dependencies {
diff --git a/filepicker/src/main/java/com/vincent/filepicker/Constant.java b/filepicker/src/main/java/com/vincent/filepicker/Constant.java
index 511b9c8..290e72c 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/Constant.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/Constant.java
@@ -11,6 +11,7 @@ public class Constant {
     public static final String MAX_VIDEO_DURATION = "MaxVideoDuration";
     public static final String VIDEO_QUALITY = "VideoQuality";
     public static final String MAX_AUDIO_SIZE = "AudioFileSize";
+    public static final String DIRECTORY = "Directory";
 
     public static final int REQUEST_CODE_PICK_IMAGE = 0x100;
     public static final String RESULT_PICK_IMAGE = "ResultPickImage";
diff --git a/filepicker/src/main/java/com/vincent/filepicker/Util.java b/filepicker/src/main/java/com/vincent/filepicker/Util.java
index edd6350..28864c3 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/Util.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/Util.java
@@ -1,16 +1,15 @@
 package com.vincent.filepicker;
 
-import android.animation.Animator;
-import android.animation.ObjectAnimator;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.util.DisplayMetrics;
-import android.view.View;
 import android.view.WindowManager;
-import android.view.animation.DecelerateInterpolator;
 
+import com.vincent.filepicker.filter.entity.BaseFile;
+
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -131,4 +130,15 @@ public static String extractFileSuffix(String url) {
             return "";
         }
     }
+
+    public static void sortFileList(List<? extends BaseFile> list) {
+        Collections.sort(list, (c1, c2) -> {
+            if (c1.getDate() > c2.getDate()) {
+                return -1;
+            } else if (c1.getDate() < c2.getDate()) {
+                return 1;
+            }
+            return 0;
+        });
+    }
 }
diff --git a/filepicker/src/main/java/com/vincent/filepicker/activity/AudioPickActivity.java b/filepicker/src/main/java/com/vincent/filepicker/activity/AudioPickActivity.java
index ee912f2..7bea7f2 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/AudioPickActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/AudioPickActivity.java
@@ -43,6 +43,7 @@ public class AudioPickActivity extends BaseActivity {
     private int mMaxNumber;
     private int mMaxSize = 0;
     private int mCurrentNumber = 0;
+    private String selectedDirectory;
     private RecyclerView mRecyclerView;
     private AudioPickAdapter mAdapter;
     private boolean isNeedRecorder;
@@ -132,17 +133,11 @@ public void onFolderListClick(Directory directory) {
                     tv_folder.setText(directory.getName());
 
                     if (TextUtils.isEmpty(directory.getPath())) { //All
-                        refreshData(mAll);
+                        selectedDirectory = null;
                     } else {
-                        for (Directory<AudioFile> dir : mAll) {
-                            if (dir.getPath().equals(directory.getPath())) {
-                                List<Directory<AudioFile>> list = new ArrayList<>();
-                                list.add(dir);
-                                refreshData(list);
-                                break;
-                            }
-                        }
+                        selectedDirectory = directory.getPath();
                     }
+                    refreshData();
                 }
             });
         }
@@ -186,12 +181,12 @@ public void onResult(List<Directory<AudioFile>> directories) {
                 }
 
                 mAll = directories;
-                refreshData(directories);
+                refreshData();
             }
         });
     }
 
-    private void refreshData(List<Directory<AudioFile>> directories) {
+    private void refreshData() {
         boolean tryToFindTaken = isTakenAutoSelected;
 
         // if auto-select taken file is enabled, make sure requirements are met
@@ -201,7 +196,10 @@ private void refreshData(List<Directory<AudioFile>> directories) {
         }
 
         List<AudioFile> list = new ArrayList<>();
-        for (Directory<AudioFile> directory : directories) {
+        for (Directory<AudioFile> directory : mAll) {
+            if (selectedDirectory != null && !directory.getPath().equals(selectedDirectory)) {
+                continue;
+            }
             list.addAll(directory.getFiles());
 
             // auto-select taken file?
@@ -216,6 +214,9 @@ private void refreshData(List<Directory<AudioFile>> directories) {
                 list.get(index).setSelected(true);
             }
         }
+
+        Util.sortFileList(list);
+
         mAdapter.refresh(list);
     }
 
diff --git a/filepicker/src/main/java/com/vincent/filepicker/activity/ImageBrowserActivity.java b/filepicker/src/main/java/com/vincent/filepicker/activity/ImageBrowserActivity.java
index cdba8a1..269a00c 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/ImageBrowserActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/ImageBrowserActivity.java
@@ -2,21 +2,23 @@
 
 import android.content.Intent;
 import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.viewpager.widget.PagerAdapter;
-import androidx.viewpager.widget.ViewPager;
-import androidx.appcompat.widget.Toolbar;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
 
+import androidx.annotation.Nullable;
+import androidx.appcompat.widget.Toolbar;
+import androidx.viewpager.widget.PagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+
 import com.bm.library.PhotoView;
 import com.bumptech.glide.Glide;
 import com.vincent.filepicker.Constant;
 import com.vincent.filepicker.R;
 import com.vincent.filepicker.ToastUtil;
+import com.vincent.filepicker.Util;
 import com.vincent.filepicker.filter.FileFilter;
 import com.vincent.filepicker.filter.callback.FilterResultCallback;
 import com.vincent.filepicker.filter.entity.Directory;
@@ -38,6 +40,7 @@ public class ImageBrowserActivity extends BaseActivity {
     public static final String IMAGE_BROWSER_INIT_INDEX = "ImageBrowserInitIndex";
     public static final String IMAGE_BROWSER_SELECTED_LIST = "ImageBrowserSelectedList";
     private int mMaxNumber;
+    private String selectedDirectory;
     private int mCurrentNumber = 0;
     private int initIndex = 0;
     private int mCurrentIndex = 0;
@@ -57,6 +60,7 @@ void permissionGranted() {
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         setContentView(R.layout.vw_activity_image_browser);
 
+        selectedDirectory = getIntent().getStringExtra(Constant.DIRECTORY);
         mMaxNumber = getIntent().getIntExtra(Constant.MAX_NUMBER, DEFAULT_MAX_NUMBER);
         initIndex = getIntent().getIntExtra(IMAGE_BROWSER_INIT_INDEX, 0);
         mCurrentIndex = initIndex;
@@ -134,7 +138,9 @@ private void loadData() {
             public void onResult(List<Directory<ImageFile>> directories) {
                 mList.clear();
                 for (Directory<ImageFile> directory : directories) {
-                    mList.addAll(directory.getFiles());
+                    if (selectedDirectory == null || directory.getPath().equals(selectedDirectory)) {
+                        mList.addAll(directory.getFiles());
+                    }
                 }
 
                 for (ImageFile file : mList) {
@@ -143,6 +149,8 @@ public void onResult(List<Directory<ImageFile>> directories) {
                     }
                 }
 
+                Util.sortFileList(mList);
+
                 initView();
                 mViewPager.getAdapter().notifyDataSetChanged();
             }
@@ -157,7 +165,7 @@ public Object instantiateItem(ViewGroup container, int position) {
             view.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
 
             Glide.with(ImageBrowserActivity.this)
-                    .load(mList.get(position).getPath())
+                    .load(mList.get(position).getUri())
                     .transition(withCrossFade())
                     .into(view);
             container.addView(view);
diff --git a/filepicker/src/main/java/com/vincent/filepicker/activity/ImagePickActivity.java b/filepicker/src/main/java/com/vincent/filepicker/activity/ImagePickActivity.java
index b1d6d3f..83da124 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/ImagePickActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/ImagePickActivity.java
@@ -3,17 +3,19 @@
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
-import androidx.recyclerview.widget.GridLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
 import android.text.TextUtils;
 import android.view.View;
 import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
 import com.vincent.filepicker.Constant;
 import com.vincent.filepicker.DividerGridItemDecoration;
 import com.vincent.filepicker.R;
+import com.vincent.filepicker.Util;
 import com.vincent.filepicker.adapter.FolderListAdapter;
 import com.vincent.filepicker.adapter.ImagePickAdapter;
 import com.vincent.filepicker.adapter.OnSelectStateListener;
@@ -41,6 +43,7 @@ public class ImagePickActivity extends BaseActivity {
     public static final int COLUMN_NUMBER = 3;
     private int mMaxNumber;
     private int mCurrentNumber = 0;
+    private String selectedDirectory;
     private RecyclerView mRecyclerView;
     private ImagePickAdapter mAdapter;
     private boolean isNeedCamera;
@@ -128,17 +131,13 @@ public void onFolderListClick(Directory directory) {
                     tv_folder.setText(directory.getName());
 
                     if (TextUtils.isEmpty(directory.getPath())) { //All
-                        refreshData(mAll);
+                        selectedDirectory = null;
+                        mAdapter.setSelectedDirectory(null);
                     } else {
-                        for (Directory<ImageFile> dir : mAll) {
-                            if (dir.getPath().equals(directory.getPath())) {
-                                List<Directory<ImageFile>> list = new ArrayList<>();
-                                list.add(dir);
-                                refreshData(list);
-                                break;
-                            }
-                        }
+                        selectedDirectory = directory.getPath();
+                        mAdapter.setSelectedDirectory(directory.getPath());
                     }
+                    refreshData();
                 }
             });
         }
@@ -199,12 +198,12 @@ public void onResult(List<Directory<ImageFile>> directories) {
                 }
 
                 mAll = directories;
-                refreshData(directories);
+                refreshData();
             }
         });
     }
 
-    private void refreshData(List<Directory<ImageFile>> directories) {
+    private void refreshData() {
         boolean tryToFindTakenImage = isTakenAutoSelected;
 
         // if auto-select taken image is enabled, make sure requirements are met
@@ -214,7 +213,10 @@ private void refreshData(List<Directory<ImageFile>> directories) {
         }
 
         List<ImageFile> list = new ArrayList<>();
-        for (Directory<ImageFile> directory : directories) {
+        for (Directory<ImageFile> directory : mAll) {
+            if (selectedDirectory != null && !directory.getPath().equals(selectedDirectory)) {
+                continue;
+            }
             list.addAll(directory.getFiles());
 
             // auto-select taken images?
@@ -229,6 +231,9 @@ private void refreshData(List<Directory<ImageFile>> directories) {
                 list.get(index).setSelected(true);
             }
         }
+
+        Util.sortFileList(list);
+
         mAdapter.refresh(list);
     }
 
diff --git a/filepicker/src/main/java/com/vincent/filepicker/activity/NormalFilePickActivity.java b/filepicker/src/main/java/com/vincent/filepicker/activity/NormalFilePickActivity.java
index 7579f6d..5accf56 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/NormalFilePickActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/NormalFilePickActivity.java
@@ -17,6 +17,7 @@
 import com.vincent.filepicker.Constant;
 import com.vincent.filepicker.DividerListItemDecoration;
 import com.vincent.filepicker.R;
+import com.vincent.filepicker.Util;
 import com.vincent.filepicker.adapter.FolderListAdapter;
 import com.vincent.filepicker.adapter.NormalFilePickAdapter;
 import com.vincent.filepicker.adapter.OnSelectStateListener;
@@ -39,6 +40,7 @@ public class NormalFilePickActivity extends BaseActivity {
     public static final String SUFFIX = "Suffix";
     private int mMaxNumber;
     private int mCurrentNumber = 0;
+    private String selectedDirectory;
     private RecyclerView mRecyclerView;
     private NormalFilePickAdapter mAdapter;
     private ArrayList<NormalFile> mSelectedList = new ArrayList<>();
@@ -126,17 +128,11 @@ public void onFolderListClick(Directory directory) {
                     tv_folder.setText(directory.getName());
 
                     if (TextUtils.isEmpty(directory.getPath())) { //All
-                        refreshData(mAll);
+                        selectedDirectory = null;
                     } else {
-                        for (Directory<NormalFile> dir : mAll) {
-                            if (dir.getPath().equals(directory.getPath())) {
-                                List<Directory<NormalFile>> list = new ArrayList<>();
-                                list.add(dir);
-                                refreshData(list);
-                                break;
-                            }
-                        }
+                        selectedDirectory = directory.getPath();
                     }
+                    refreshData();
                 }
             });
         }
@@ -157,15 +153,18 @@ public void onResult(List<Directory<NormalFile>> directories) {
                 }
 
                 mAll = directories;
-                refreshData(directories);
+                refreshData();
             }
         }, mSuffix);
     }
 
-    private void refreshData(List<Directory<NormalFile>> directories) {
+    private void refreshData() {
         mProgressBar.setVisibility(View.GONE);
         List<NormalFile> list = new ArrayList<>();
-        for (Directory<NormalFile> directory : directories) {
+        for (Directory<NormalFile> directory : mAll) {
+            if (selectedDirectory != null && !directory.getPath().equals(selectedDirectory)) {
+                continue;
+            }
             list.addAll(directory.getFiles());
         }
 
@@ -176,6 +175,8 @@ private void refreshData(List<Directory<NormalFile>> directories) {
             }
         }
 
+        Util.sortFileList(list);
+
         mAdapter.refresh(list);
     }
 }
diff --git a/filepicker/src/main/java/com/vincent/filepicker/activity/VideoPickActivity.java b/filepicker/src/main/java/com/vincent/filepicker/activity/VideoPickActivity.java
index 9def973..e339bdd 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/VideoPickActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/VideoPickActivity.java
@@ -3,9 +3,6 @@
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.GridLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
 import android.text.TextUtils;
 import android.view.View;
 import android.widget.LinearLayout;
@@ -13,9 +10,14 @@
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
 import com.vincent.filepicker.Constant;
 import com.vincent.filepicker.DividerGridItemDecoration;
 import com.vincent.filepicker.R;
+import com.vincent.filepicker.Util;
 import com.vincent.filepicker.adapter.FolderListAdapter;
 import com.vincent.filepicker.adapter.OnSelectStateListener;
 import com.vincent.filepicker.adapter.VideoPickAdapter;
@@ -46,6 +48,7 @@ public class VideoPickActivity extends BaseActivity {
     private int mCurrentNumber;
     private int mMaxVideoDuration = 0;
     private int mVideoQuality = 1;
+    private String selectedDirectory;
     private RecyclerView mRecyclerView;
     private VideoPickAdapter mAdapter;
     private boolean isNeedCamera;
@@ -143,17 +146,11 @@ public void onFolderListClick(Directory directory) {
                     tv_folder.setText(directory.getName());
 
                     if (TextUtils.isEmpty(directory.getPath())) { //All
-                        refreshData(mAll);
+                        selectedDirectory = null;
                     } else {
-                        for (Directory<VideoFile> dir : mAll) {
-                            if (dir.getPath().equals(directory.getPath())) {
-                                List<Directory<VideoFile>> list = new ArrayList<>();
-                                list.add(dir);
-                                refreshData(list);
-                                break;
-                            }
-                        }
+                        selectedDirectory = directory.getPath();
                     }
+                    refreshData();
                 }
             });
         }
@@ -193,12 +190,12 @@ public void onResult(List<Directory<VideoFile>> directories) {
                 }
 
                 mAll = directories;
-                refreshData(directories);
+                refreshData();
             }
         });
     }
 
-    private void refreshData(List<Directory<VideoFile>> directories) {
+    private void refreshData() {
         boolean tryToFindTaken = isTakenAutoSelected;
 
         // if auto-select taken file is enabled, make sure requirements are met
@@ -208,7 +205,10 @@ private void refreshData(List<Directory<VideoFile>> directories) {
         }
 
         List<VideoFile> list = new ArrayList<>();
-        for (Directory<VideoFile> directory : directories) {
+        for (Directory<VideoFile> directory : mAll) {
+            if (selectedDirectory != null && !directory.getPath().equals(selectedDirectory)) {
+                continue;
+            }
             list.addAll(directory.getFiles());
 
             // auto-select taken file?
@@ -223,6 +223,9 @@ private void refreshData(List<Directory<VideoFile>> directories) {
                 list.get(index).setSelected(true);
             }
         }
+
+        Util.sortFileList(list);
+
         mAdapter.refresh(list);
     }
 
diff --git a/filepicker/src/main/java/com/vincent/filepicker/adapter/AudioPickAdapter.java b/filepicker/src/main/java/com/vincent/filepicker/adapter/AudioPickAdapter.java
index 1220291..9f0c513 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/AudioPickAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/AudioPickAdapter.java
@@ -2,22 +2,19 @@
 
 import android.content.Context;
 import android.content.Intent;
-import android.net.Uri;
-import android.os.Build;
-import androidx.core.content.FileProvider;
-import androidx.recyclerview.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import androidx.recyclerview.widget.RecyclerView;
+
 import com.vincent.filepicker.R;
 import com.vincent.filepicker.ToastUtil;
 import com.vincent.filepicker.Util;
 import com.vincent.filepicker.filter.entity.AudioFile;
 
-import java.io.File;
 import java.util.ArrayList;
 
 /**
@@ -93,15 +90,8 @@ public void onClick(View v) {
             @Override
             public void onClick(View v) {
                 Intent intent = new Intent(Intent.ACTION_VIEW);
-                Uri uri;
-                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
-                    intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
-                    File f = new File(file.getPath());
-                    uri = FileProvider.getUriForFile(mContext, mContext.getApplicationContext().getPackageName() + ".provider", f);
-                }else{
-                    uri = Uri.parse("file://" + file.getPath());
-                }
-                intent.setDataAndType(uri, "audio/mp3");
+                intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+                intent.setDataAndType(file.getUri(), "audio/mp3");
                 if (Util.detectIntent(mContext, intent)) {
                     mContext.startActivity(intent);
                 } else {
diff --git a/filepicker/src/main/java/com/vincent/filepicker/adapter/ImagePickAdapter.java b/filepicker/src/main/java/com/vincent/filepicker/adapter/ImagePickAdapter.java
index e915997..0a3d08f 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/ImagePickAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/ImagePickAdapter.java
@@ -48,6 +48,7 @@ public class ImagePickAdapter extends BaseAdapter<ImageFile, ImagePickAdapter.Im
     private int mCurrentNumber = 0;
     public String mImagePath;
     public Uri mImageUri;
+    private String selectedDirectory;
 
     public ImagePickAdapter(Context ctx, boolean needCamera, boolean isNeedImagePager, int max) {
         this(ctx, new ArrayList<ImageFile>(), needCamera, isNeedImagePager, max);
@@ -114,7 +115,7 @@ public void onClick(View v) {
 
             RequestOptions options = new RequestOptions();
             Glide.with(mContext)
-                    .load(file.getPath())
+                    .load(file.getUri())
                     .apply(options.centerCrop())
                     .transition(withCrossFade())
 //                    .transition(new DrawableTransitionOptions().crossFade(500))
@@ -161,6 +162,7 @@ public void onClick(View v) {
                     public void onClick(View v) {
                         Intent intent = new Intent(mContext, ImageBrowserActivity.class);
                         intent.putExtra(Constant.MAX_NUMBER, mMaxNumber);
+                        intent.putExtra(Constant.DIRECTORY, selectedDirectory);
                         intent.putExtra(IMAGE_BROWSER_INIT_INDEX,
                                 isNeedCamera ? holder.getAdapterPosition() - 1 : holder.getAdapterPosition());
                         intent.putParcelableArrayListExtra(IMAGE_BROWSER_SELECTED_LIST, ((ImagePickActivity) mContext).mSelectedList);
@@ -218,6 +220,10 @@ public ImagePickViewHolder(View itemView) {
         }
     }
 
+    public void setSelectedDirectory(String selectedDirectory) {
+        this.selectedDirectory = selectedDirectory;
+    }
+
     public boolean isUpToMax() {
         return mCurrentNumber >= mMaxNumber;
     }
diff --git a/filepicker/src/main/java/com/vincent/filepicker/adapter/VideoPickAdapter.java b/filepicker/src/main/java/com/vincent/filepicker/adapter/VideoPickAdapter.java
index e28786f..5b271a2 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/VideoPickAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/VideoPickAdapter.java
@@ -5,11 +5,8 @@
 import android.content.Context;
 import android.content.Intent;
 import android.net.Uri;
-import android.os.Build;
 import android.os.Environment;
 import android.provider.MediaStore;
-import androidx.core.content.FileProvider;
-import androidx.recyclerview.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -18,6 +15,8 @@
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import androidx.recyclerview.widget.RecyclerView;
+
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.request.RequestOptions;
 import com.vincent.filepicker.R;
@@ -92,8 +91,8 @@ public void onClick(View v) {
                     mVideoPath = file.getAbsolutePath();
 
                     ContentValues contentValues = new ContentValues(1);
-                    contentValues.put(MediaStore.Images.Media.DATA, mVideoPath);
-                    Uri uri = mContext.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
+                    contentValues.put(MediaStore.Video.Media.DATA, mVideoPath);
+                    Uri uri = mContext.getContentResolver().insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, contentValues);
 
                     intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
                     intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, mVideoQuality);
@@ -122,7 +121,7 @@ public void onClick(View v) {
 
             RequestOptions options = new RequestOptions();
             Glide.with(mContext)
-                    .load(file.getPath())
+                    .load(file.getUri())
                     .apply(options.centerCrop())
                     .transition(withCrossFade())
 //                    .transition(new DrawableTransitionOptions().crossFade(500))
@@ -167,15 +166,8 @@ public void onClick(View v) {
                 @Override
                 public void onClick(View v) {
                     Intent intent = new Intent(Intent.ACTION_VIEW);
-                    Uri uri;
-                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
-                        intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
-                        File f = new File(file.getPath());
-                        uri = FileProvider.getUriForFile(mContext, mContext.getApplicationContext().getPackageName() + ".provider", f);
-                    }else{
-                        uri = Uri.parse("file://" + file.getPath());
-                    }
-                    intent.setDataAndType(uri, "video/mp4");
+                    intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+                    intent.setDataAndType(file.getUri(), "video/mp4");
                     if (Util.detectIntent(mContext, intent)) {
                         mContext.startActivity(intent);
                     } else {
diff --git a/filepicker/src/main/java/com/vincent/filepicker/filter/FileFilter.java b/filepicker/src/main/java/com/vincent/filepicker/filter/FileFilter.java
index 8eb4795..ec0985c 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/filter/FileFilter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/filter/FileFilter.java
@@ -1,6 +1,7 @@
 package com.vincent.filepicker.filter;
 
 import androidx.fragment.app.FragmentActivity;
+import androidx.loader.app.LoaderManager;
 
 import com.vincent.filepicker.filter.callback.FileLoaderCallbacks;
 import com.vincent.filepicker.filter.callback.FilterResultCallback;
@@ -22,23 +23,23 @@
 
 public class FileFilter {
     public static void getImages(FragmentActivity activity, FilterResultCallback<ImageFile> callback){
-        activity.getSupportLoaderManager().initLoader(0, null,
+        LoaderManager.getInstance(activity).initLoader(0, null,
                 new FileLoaderCallbacks(activity, callback, TYPE_IMAGE));
     }
 
     public static void getVideos(FragmentActivity activity, FilterResultCallback<VideoFile> callback){
-        activity.getSupportLoaderManager().initLoader(1, null,
+        LoaderManager.getInstance(activity).initLoader(1, null,
                 new FileLoaderCallbacks(activity, callback, TYPE_VIDEO));
     }
 
     public static void getAudios(FragmentActivity activity, FilterResultCallback<AudioFile> callback){
-        activity.getSupportLoaderManager().initLoader(2, null,
+        LoaderManager.getInstance(activity).initLoader(2, null,
                 new FileLoaderCallbacks(activity, callback, TYPE_AUDIO));
     }
 
     public static void getFiles(FragmentActivity activity,
                                 FilterResultCallback<NormalFile> callback, String[] suffix){
-        activity.getSupportLoaderManager().initLoader(3, null,
+        LoaderManager.getInstance(activity).initLoader(3, null,
                 new FileLoaderCallbacks(activity, callback, TYPE_FILE, suffix));
     }
 }
diff --git a/filepicker/src/main/java/com/vincent/filepicker/filter/callback/FileLoaderCallbacks.java b/filepicker/src/main/java/com/vincent/filepicker/filter/callback/FileLoaderCallbacks.java
index cd2f0e2..c63c475 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/filter/callback/FileLoaderCallbacks.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/filter/callback/FileLoaderCallbacks.java
@@ -1,8 +1,12 @@
 package com.vincent.filepicker.filter.callback;
 
+import android.content.ContentUris;
 import android.content.Context;
 import android.database.Cursor;
+import android.net.Uri;
 import android.os.Bundle;
+import android.provider.MediaStore;
+
 import androidx.loader.app.LoaderManager;
 import androidx.loader.content.CursorLoader;
 import androidx.loader.content.Loader;
@@ -134,6 +138,9 @@ private void onImageResult(Cursor data) {
 
             img.setOrientation(data.getInt(data.getColumnIndexOrThrow(ORIENTATION)));
 
+            Uri uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, img.getId());
+            img.setUri(uri);
+
             //Create a Directory
             Directory<ImageFile> directory = new Directory<>();
             directory.setId(img.getBucketId());
@@ -174,6 +181,9 @@ private void onVideoResult(final Cursor data) {
 
             video.setDuration(data.getLong(data.getColumnIndexOrThrow(DURATION)));
 
+            Uri uri = ContentUris.withAppendedId(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, video.getId());
+            video.setUri(uri);
+
             //Create a Directory
             Directory<VideoFile> directory = new Directory<>();
             directory.setId(video.getBucketId());
@@ -212,6 +222,9 @@ private void onAudioResult(Cursor data) {
 
             audio.setDuration(data.getLong(data.getColumnIndexOrThrow(DURATION)));
 
+            Uri uri = ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, audio.getId());
+            audio.setUri(uri);
+
             //Create a Directory
             Directory<AudioFile> directory = new Directory<>();
             directory.setName(Util.extractFileNameWithSuffix(Util.extractPathWithoutSeparator(audio.getPath())));
@@ -251,6 +264,9 @@ private void onFileResult(Cursor data) {
 
                 file.setMimeType(data.getString(data.getColumnIndexOrThrow(MIME_TYPE)));
 
+                Uri uri = ContentUris.withAppendedId(MediaStore.Files.getContentUri("external"), file.getId());
+                file.setUri(uri);
+
                 //Create a Directory
                 Directory<NormalFile> directory = new Directory<>();
                 directory.setName(Util.extractFileNameWithSuffix(Util.extractPathWithoutSeparator(file.getPath())));
diff --git a/filepicker/src/main/java/com/vincent/filepicker/filter/entity/BaseFile.java b/filepicker/src/main/java/com/vincent/filepicker/filter/entity/BaseFile.java
index e760d33..70c7aeb 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/filter/entity/BaseFile.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/filter/entity/BaseFile.java
@@ -1,5 +1,6 @@
 package com.vincent.filepicker.filter.entity;
 
+import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -13,6 +14,7 @@ public class BaseFile implements Parcelable {
     private long id;
     private String name;
     private String path;
+    private Uri uri;
     private long size;   //byte
     private String bucketId;  //Directory ID
     private String bucketName;  //Directory Name
@@ -57,6 +59,14 @@ public void setPath(String path) {
         this.path = path;
     }
 
+    public Uri getUri() {
+        return uri;
+    }
+
+    public void setUri(Uri uri) {
+        this.uri = uri;
+    }
+
     public long getSize() {
         return size;
     }
diff --git a/filepicker/src/main/java/com/vincent/filepicker/filter/loader/AudioLoader.java b/filepicker/src/main/java/com/vincent/filepicker/filter/loader/AudioLoader.java
index c945006..e06fc23 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/filter/loader/AudioLoader.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/filter/loader/AudioLoader.java
@@ -34,15 +34,8 @@ public AudioLoader(Context context) {
         super(context);
 
         setProjection(AUDIO_PROJECTION);
-        setUri(MediaStore.Files.getContentUri("external"));
+        setUri(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
         setSortOrder(MediaStore.Audio.Media.DATE_ADDED + " DESC");
 
-        setSelection(MIME_TYPE + "=? or "
-                + MIME_TYPE + "=? or "
-                + MIME_TYPE + "=? or "
-                + MIME_TYPE + "=?");
-        String[] selectionArgs;
-        selectionArgs = new String[]{"audio/mpeg", "audio/mp3", "audio/x-ms-wma", "audio/mp4"};
-        setSelectionArgs(selectionArgs);
     }
 }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 696b99c..5cb3f97 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Sun Dec 29 18:00:03 IST 2019
+#Fri Jul 17 11:34:37 BRT 2020
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
