diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..f82e526
Binary files /dev/null and b/.DS_Store differ
diff --git a/app/build.gradle b/app/build.gradle
index b112300..0fa1793 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,15 +1,14 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 26
- buildToolsVersion "26.0.2"
+ compileSdkVersion 29
defaultConfig {
applicationId "com.vincent.filepickersample"
- minSdkVersion 14
- targetSdkVersion 26
+ minSdkVersion 19
+ targetSdkVersion 29
versionCode 1
versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
@@ -20,12 +19,12 @@ android {
}
dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ androidTestCompile('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- compile 'com.android.support:appcompat-v7:26.1.0'
+ implementation 'androidx.appcompat:appcompat:1.1.0'
- testCompile 'junit:junit:4.12'
- compile project(':filepicker')
+ testImplementation 'junit:junit:4.13'
+ implementation project(':filepicker')
}
diff --git a/app/src/androidTest/java/com/vincent/filepickersample/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/vincent/filepickersample/ExampleInstrumentedTest.java
index 0bb89a4..4e432a4 100644
--- a/app/src/androidTest/java/com/vincent/filepickersample/ExampleInstrumentedTest.java
+++ b/app/src/androidTest/java/com/vincent/filepickersample/ExampleInstrumentedTest.java
@@ -1,8 +1,8 @@
package com.vincent.filepickersample;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f09d4a2..638cdda 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,19 +2,24 @@
+
+
+
+ android:theme="@style/AppTheme">
+
+
diff --git a/app/src/main/java/com/vincent/filepickersample/MainActivity.java b/app/src/main/java/com/vincent/filepickersample/MainActivity.java
index 06ea11b..0e92f5d 100644
--- a/app/src/main/java/com/vincent/filepickersample/MainActivity.java
+++ b/app/src/main/java/com/vincent/filepickersample/MainActivity.java
@@ -1,31 +1,22 @@
package com.vincent.filepickersample;
import android.content.Intent;
-import android.support.v7.app.AppCompatActivity;
+import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
-import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.vincent.filepicker.Constant;
-import com.vincent.filepicker.Util;
import com.vincent.filepicker.activity.AudioPickActivity;
import com.vincent.filepicker.activity.ImagePickActivity;
import com.vincent.filepicker.activity.NormalFilePickActivity;
import com.vincent.filepicker.activity.VideoPickActivity;
-import com.vincent.filepicker.filter.FileFilter;
-import com.vincent.filepicker.filter.callback.FilterResultCallback;
import com.vincent.filepicker.filter.entity.AudioFile;
-import com.vincent.filepicker.filter.entity.BaseFile;
-import com.vincent.filepicker.filter.entity.Directory;
import com.vincent.filepicker.filter.entity.ImageFile;
import com.vincent.filepicker.filter.entity.NormalFile;
import com.vincent.filepicker.filter.entity.VideoFile;
import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import static com.vincent.filepicker.activity.AudioPickActivity.IS_NEED_RECORDER;
import static com.vincent.filepicker.activity.BaseActivity.IS_NEED_FOLDER_LIST;
@@ -69,7 +60,7 @@ public void onClick(View v) {
break;
case R.id.btn_pick_file:
Intent intent4 = new Intent(this, NormalFilePickActivity.class);
- intent4.putExtra(Constant.MAX_NUMBER, 9);
+ intent4.putExtra(Constant.MAX_NUMBER, 1);
intent4.putExtra(IS_NEED_FOLDER_LIST, true);
intent4.putExtra(NormalFilePickActivity.SUFFIX,
new String[] {"xlsx", "xls", "doc", "dOcX", "ppt", ".pptx", "pdf"});
@@ -80,6 +71,7 @@ public void onClick(View v) {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case Constant.REQUEST_CODE_PICK_IMAGE:
if (resultCode == RESULT_OK) {
diff --git a/build.gradle b/build.gradle
index b0c2fb8..7d09572 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,9 +6,9 @@ buildscript {
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.2'
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
+ classpath 'com.android.tools.build:gradle:3.6.3'
+ classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
+ classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
diff --git a/filepicker/build.gradle b/filepicker/build.gradle
index ecc6a0a..f896b44 100644
--- a/filepicker/build.gradle
+++ b/filepicker/build.gradle
@@ -1,15 +1,14 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 26
- buildToolsVersion "26.0.2"
+ compileSdkVersion 29
defaultConfig {
- minSdkVersion 14
- targetSdkVersion 26
+ minSdkVersion 19
+ targetSdkVersion 29
versionCode 1
versionName "1.0.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
@@ -20,22 +19,22 @@ android {
}
dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ api fileTree(include: ['*.jar'], dir: 'libs')
+ androidTestCompile('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- compile 'com.android.support:appcompat-v7:26.1.0'
- testCompile 'junit:junit:4.12'
- compile 'com.android.support:recyclerview-v7:26.1.0'
+ api 'androidx.appcompat:appcompat:1.1.0'
+ testImplementation 'junit:junit:4.13'
+ api 'androidx.recyclerview:recyclerview:1.1.0'
//Glide
- compile ("com.github.bumptech.glide:glide:4.6.1") {
+ api ("com.github.bumptech.glide:glide:4.11.0") {
exclude group: "com.android.support"
}
- compile 'com.github.bumptech.glide:annotations:4.6.1'
- annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
- compile 'com.bm.photoview:library:1.4.1'
- compile 'com.android.support:design:26.1.0'
- compile 'pub.devrel:easypermissions:0.3.0'
+ api 'com.github.bumptech.glide:annotations:4.11.0'
+ annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
+ api 'com.bm.photoview:library:1.4.1'
+ api 'com.google.android.material:material:1.1.0'
+ api 'pub.devrel:easypermissions:3.0.0'
}
apply from: 'publish.gradle'
\ No newline at end of file
diff --git a/filepicker/src/androidTest/java/com/vincent/filepicker/ExampleInstrumentedTest.java b/filepicker/src/androidTest/java/com/vincent/filepicker/ExampleInstrumentedTest.java
index 400719b..471d53c 100644
--- a/filepicker/src/androidTest/java/com/vincent/filepicker/ExampleInstrumentedTest.java
+++ b/filepicker/src/androidTest/java/com/vincent/filepicker/ExampleInstrumentedTest.java
@@ -1,8 +1,8 @@
package com.vincent.filepicker;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/filepicker/src/main/AndroidManifest.xml b/filepicker/src/main/AndroidManifest.xml
index 229e584..1cc7abe 100644
--- a/filepicker/src/main/AndroidManifest.xml
+++ b/filepicker/src/main/AndroidManifest.xml
@@ -5,7 +5,7 @@
diff --git a/filepicker/src/main/java/com/vincent/filepicker/DividerGridItemDecoration.java b/filepicker/src/main/java/com/vincent/filepicker/DividerGridItemDecoration.java
index d7b95fc..9de28bf 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/DividerGridItemDecoration.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/DividerGridItemDecoration.java
@@ -5,9 +5,9 @@
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.support.v7.widget.GridLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.StaggeredGridLayoutManager;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.view.View;
/**
diff --git a/filepicker/src/main/java/com/vincent/filepicker/DividerListItemDecoration.java b/filepicker/src/main/java/com/vincent/filepicker/DividerListItemDecoration.java
index 1660d7e..7658f15 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/DividerListItemDecoration.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/DividerListItemDecoration.java
@@ -5,9 +5,9 @@
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
/**
diff --git a/filepicker/src/main/java/com/vincent/filepicker/FolderListHelper.java b/filepicker/src/main/java/com/vincent/filepicker/FolderListHelper.java
index 697372e..decd484 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/FolderListHelper.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/FolderListHelper.java
@@ -3,13 +3,11 @@
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.view.Gravity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
import android.widget.PopupWindow;
import com.vincent.filepicker.adapter.FolderListAdapter;
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 1b7976b..e867f47 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/AudioPickActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/AudioPickActivity.java
@@ -3,9 +3,9 @@
import android.content.Intent;
import android.os.Bundle;
import android.provider.MediaStore;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
diff --git a/filepicker/src/main/java/com/vincent/filepicker/activity/BaseActivity.java b/filepicker/src/main/java/com/vincent/filepicker/activity/BaseActivity.java
index 71d5724..2f64fd2 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/BaseActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/BaseActivity.java
@@ -2,16 +2,14 @@
import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import com.vincent.filepicker.FolderListHelper;
import com.vincent.filepicker.R;
-import com.vincent.filepicker.adapter.FolderListAdapter;
-import com.vincent.filepicker.filter.entity.Directory;
import java.util.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 1611246..cdba8a1 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/ImageBrowserActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/ImageBrowserActivity.java
@@ -2,10 +2,10 @@
import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.view.PagerAdapter;
-import android.support.v4.view.ViewPager;
-import android.support.v7.widget.Toolbar;
+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;
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 04ad15d..b1d6d3f 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/ImagePickActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/ImagePickActivity.java
@@ -3,8 +3,8 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
-import android.support.v7.widget.GridLayoutManager;
-import android.support.v7.widget.RecyclerView;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
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 ca704b2..41cd341 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/activity/NormalFilePickActivity.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/activity/NormalFilePickActivity.java
@@ -2,14 +2,13 @@
import android.content.Intent;
import android.os.Bundle;
-import android.os.Handler;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.Toolbar;
+
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.appcompat.widget.Toolbar;
import android.text.TextUtils;
-import android.view.Menu;
-import android.view.MenuItem;
+import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
@@ -66,6 +65,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mMaxNumber = getIntent().getIntExtra(Constant.MAX_NUMBER, DEFAULT_MAX_NUMBER);
mSuffix = getIntent().getStringArrayExtra(SUFFIX);
+
initView();
}
@@ -149,6 +149,7 @@ private void loadData() {
@Override
public void onResult(List> directories) {
// Refresh folder list
+ Log.d("onResult", "onResult: " + directories);
if (isNeedFolderList) {
ArrayList list = new ArrayList<>();
Directory all = new Directory();
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 fa36965..4cc89f4 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,9 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.GridLayoutManager;
-import android.support.v7.widget.RecyclerView;
+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;
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 97375b2..1220291 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/AudioPickAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/AudioPickAdapter.java
@@ -4,8 +4,8 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
-import android.support.v4.content.FileProvider;
-import android.support.v7.widget.RecyclerView;
+import androidx.core.content.FileProvider;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/filepicker/src/main/java/com/vincent/filepicker/adapter/BaseAdapter.java b/filepicker/src/main/java/com/vincent/filepicker/adapter/BaseAdapter.java
index 09f8362..8352727 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/BaseAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/BaseAdapter.java
@@ -1,7 +1,7 @@
package com.vincent.filepicker.adapter;
import android.content.Context;
-import android.support.v7.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
diff --git a/filepicker/src/main/java/com/vincent/filepicker/adapter/FolderListAdapter.java b/filepicker/src/main/java/com/vincent/filepicker/adapter/FolderListAdapter.java
index e3a3f90..33b1521 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/FolderListAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/FolderListAdapter.java
@@ -1,7 +1,7 @@
package com.vincent.filepicker.adapter;
import android.content.Context;
-import android.support.v7.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -9,10 +9,8 @@
import com.vincent.filepicker.R;
import com.vincent.filepicker.filter.entity.Directory;
-import com.vincent.filepicker.filter.entity.ImageFile;
import java.util.ArrayList;
-import java.util.List;
/**
* Created by Vincent Woo
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 e35827d..e915997 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/ImagePickAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/ImagePickAdapter.java
@@ -7,7 +7,7 @@
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
-import android.support.v7.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/filepicker/src/main/java/com/vincent/filepicker/adapter/NormalFilePickAdapter.java b/filepicker/src/main/java/com/vincent/filepicker/adapter/NormalFilePickAdapter.java
index fef09f3..79d9979 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/NormalFilePickAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/NormalFilePickAdapter.java
@@ -1,7 +1,7 @@
package com.vincent.filepicker.adapter;
import android.content.Context;
-import android.support.v7.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
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 f2dbed8..5d1ed45 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/adapter/VideoPickAdapter.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/adapter/VideoPickAdapter.java
@@ -8,8 +8,8 @@
import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore;
-import android.support.v4.content.FileProvider;
-import android.support.v7.widget.RecyclerView;
+import androidx.core.content.FileProvider;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
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 43725ea..6025e08 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,9 @@
package com.vincent.filepicker.filter;
-import android.support.v4.app.FragmentActivity;
+import android.util.Log;
+
+import androidx.fragment.app.FragmentActivity;
+import androidx.loader.app.LoaderManager;
import com.vincent.filepicker.filter.callback.FileLoaderCallbacks;
import com.vincent.filepicker.filter.callback.FilterResultCallback;
@@ -21,24 +24,24 @@
*/
public class FileFilter {
- public static void getImages(FragmentActivity activity, FilterResultCallback callback){
+ public static void getImages(FragmentActivity activity, FilterResultCallback callback) {
activity.getSupportLoaderManager().initLoader(0, null,
new FileLoaderCallbacks(activity, callback, TYPE_IMAGE));
}
- public static void getVideos(FragmentActivity activity, FilterResultCallback callback){
+ public static void getVideos(FragmentActivity activity, FilterResultCallback callback) {
activity.getSupportLoaderManager().initLoader(1, null,
new FileLoaderCallbacks(activity, callback, TYPE_VIDEO));
}
- public static void getAudios(FragmentActivity activity, FilterResultCallback callback){
+ public static void getAudios(FragmentActivity activity, FilterResultCallback callback) {
activity.getSupportLoaderManager().initLoader(2, null,
new FileLoaderCallbacks(activity, callback, TYPE_AUDIO));
}
- public static void getFiles(FragmentActivity activity,
- FilterResultCallback callback, String[] suffix){
- activity.getSupportLoaderManager().initLoader(3, null,
- new FileLoaderCallbacks(activity, callback, TYPE_FILE, suffix));
+ public static void getFiles(FragmentActivity activity, FilterResultCallback callback, String[] suffix) {
+ LoaderManager.getInstance(activity).initLoader(3, null, new FileLoaderCallbacks(activity, callback, TYPE_FILE, suffix));
+// activity.getSupportLoaderManager().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 b07c102..075561a 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
@@ -2,13 +2,13 @@
import android.content.Context;
import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.media.MediaMetadataRetriever;
-import android.media.ThumbnailUtils;
import android.os.Bundle;
-import android.support.v4.app.LoaderManager;
-import android.support.v4.content.CursorLoader;
-import android.support.v4.content.Loader;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.loader.app.LoaderManager;
+import androidx.loader.content.CursorLoader;
+import androidx.loader.content.Loader;
import com.vincent.filepicker.Util;
import com.vincent.filepicker.filter.entity.AudioFile;
@@ -21,14 +21,9 @@
import com.vincent.filepicker.filter.loader.ImageLoader;
import com.vincent.filepicker.filter.loader.VideoLoader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -68,6 +63,7 @@ public FileLoaderCallbacks(Context context, FilterResultCallback resultCallback,
}
public FileLoaderCallbacks(Context context, FilterResultCallback resultCallback, int type, String[] suffixArgs) {
+
this.context = new WeakReference<>(context);
this.resultCallback = resultCallback;
this.mType = type;
@@ -77,8 +73,10 @@ public FileLoaderCallbacks(Context context, FilterResultCallback resultCallback,
}
}
+ @NonNull
@Override
public Loader onCreateLoader(int id, Bundle args) {
+ Log.d("onCreateLoader", "onCreateLoader: " + id + " " + args);
switch (mType) {
case TYPE_IMAGE:
mLoader = new ImageLoader(context.get());
@@ -98,7 +96,7 @@ public Loader onCreateLoader(int id, Bundle args) {
}
@Override
- public void onLoadFinished(Loader loader, Cursor data) {
+ public void onLoadFinished(@NonNull Loader loader, Cursor data) {
if (data == null) return;
switch (mType) {
case TYPE_IMAGE:
@@ -131,6 +129,7 @@ private void onImageResult(Cursor data) {
while (data.moveToNext()) {
//Create a File instance
+
ImageFile img = new ImageFile();
img.setId(data.getLong(data.getColumnIndexOrThrow(_ID)));
img.setName(data.getString(data.getColumnIndexOrThrow(TITLE)));
@@ -245,9 +244,12 @@ private void onFileResult(Cursor data) {
if (data.getPosition() != -1) {
data.moveToPosition(-1);
}
+ Log.d("onFileResult", "onFileResult: " + data.moveToNext());
while (data.moveToNext()) {
String path = data.getString(data.getColumnIndexOrThrow(DATA));
+ Log.d("onFileResult", "onFileResult: " + path);
+
if (path != null && contains(path)) {
//Create a File instance
NormalFile file = new NormalFile();
@@ -287,8 +289,8 @@ private boolean contains(String path) {
private String obtainSuffixRegex(String[] suffixes) {
StringBuilder builder = new StringBuilder();
- for (int i = 0; i < suffixes.length ; i++) {
- if (i ==0) {
+ for (int i = 0; i < suffixes.length; i++) {
+ if (i == 0) {
builder.append(suffixes[i].replace(".", ""));
} else {
builder.append("|\\.");
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 f64fd0f..21dae59 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
@@ -3,7 +3,7 @@
import android.content.Context;
import android.net.Uri;
import android.provider.MediaStore;
-import android.support.v4.content.CursorLoader;
+import androidx.loader.content.CursorLoader;
import static android.provider.MediaStore.MediaColumns.MIME_TYPE;
diff --git a/filepicker/src/main/java/com/vincent/filepicker/filter/loader/FileLoader.java b/filepicker/src/main/java/com/vincent/filepicker/filter/loader/FileLoader.java
index 9059dd2..13c20c3 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/filter/loader/FileLoader.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/filter/loader/FileLoader.java
@@ -3,9 +3,7 @@
import android.content.Context;
import android.net.Uri;
import android.provider.MediaStore;
-import android.support.v4.content.CursorLoader;
-
-import static android.provider.MediaStore.MediaColumns.MIME_TYPE;
+import androidx.loader.content.CursorLoader;
/**
* Created by Vincent Woo
@@ -24,6 +22,7 @@ public class FileLoader extends CursorLoader {
//Normal File
MediaStore.Files.FileColumns.MIME_TYPE
+
};
private FileLoader(Context context, Uri uri, String[] projection, String selection,
diff --git a/filepicker/src/main/java/com/vincent/filepicker/filter/loader/ImageLoader.java b/filepicker/src/main/java/com/vincent/filepicker/filter/loader/ImageLoader.java
index 26d3f19..67f41e6 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/filter/loader/ImageLoader.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/filter/loader/ImageLoader.java
@@ -3,7 +3,7 @@
import android.content.Context;
import android.net.Uri;
import android.provider.MediaStore;
-import android.support.v4.content.CursorLoader;
+import androidx.loader.content.CursorLoader;
import static android.provider.MediaStore.MediaColumns.MIME_TYPE;
diff --git a/filepicker/src/main/java/com/vincent/filepicker/filter/loader/VideoLoader.java b/filepicker/src/main/java/com/vincent/filepicker/filter/loader/VideoLoader.java
index fe3978c..af6f5c4 100644
--- a/filepicker/src/main/java/com/vincent/filepicker/filter/loader/VideoLoader.java
+++ b/filepicker/src/main/java/com/vincent/filepicker/filter/loader/VideoLoader.java
@@ -3,7 +3,7 @@
import android.content.Context;
import android.net.Uri;
import android.provider.MediaStore;
-import android.support.v4.content.CursorLoader;
+import androidx.loader.content.CursorLoader;
import static android.provider.MediaStore.MediaColumns.MIME_TYPE;
diff --git a/filepicker/src/main/res/drawable-xxhdpi/vw_ic_back.png b/filepicker/src/main/res/drawable-xxhdpi/vw_ic_back.png
deleted file mode 100644
index 216b988..0000000
Binary files a/filepicker/src/main/res/drawable-xxhdpi/vw_ic_back.png and /dev/null differ
diff --git a/filepicker/src/main/res/drawable/ic_arrow_back_black_24dp.xml b/filepicker/src/main/res/drawable/ic_arrow_back_black_24dp.xml
new file mode 100644
index 0000000..3b2c626
--- /dev/null
+++ b/filepicker/src/main/res/drawable/ic_arrow_back_black_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/filepicker/src/main/res/drawable/vw_ic_back.xml b/filepicker/src/main/res/drawable/vw_ic_back.xml
new file mode 100644
index 0000000..5dd1660
--- /dev/null
+++ b/filepicker/src/main/res/drawable/vw_ic_back.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/filepicker/src/main/res/layout/vw_activity_audio_pick.xml b/filepicker/src/main/res/layout/vw_activity_audio_pick.xml
index 01b1746..7b2e31d 100644
--- a/filepicker/src/main/res/layout/vw_activity_audio_pick.xml
+++ b/filepicker/src/main/res/layout/vw_activity_audio_pick.xml
@@ -6,7 +6,7 @@
-
-
-
-
-
-
-
diff --git a/filepicker/src/main/res/layout/vw_layout_item_normal_file_pick.xml b/filepicker/src/main/res/layout/vw_layout_item_normal_file_pick.xml
index f7a89c1..2551cdb 100644
--- a/filepicker/src/main/res/layout/vw_layout_item_normal_file_pick.xml
+++ b/filepicker/src/main/res/layout/vw_layout_item_normal_file_pick.xml
@@ -10,16 +10,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
- android:layout_marginLeft="10dp"
+ android:layout_marginStart="10dp"
android:src="@drawable/vw_ic_audio" />
@@ -47,9 +47,9 @@
android:id="@+id/txt_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
- android:layout_marginRight="5dp"
+ android:layout_marginEnd="5dp"
android:textColor="#FFFFFF"
android:text="08:00"
android:textSize="12sp" />
diff --git a/filepicker/src/main/res/layout/vw_layout_top_bar.xml b/filepicker/src/main/res/layout/vw_layout_top_bar.xml
index 3dbc50e..1e603f4 100644
--- a/filepicker/src/main/res/layout/vw_layout_top_bar.xml
+++ b/filepicker/src/main/res/layout/vw_layout_top_bar.xml
@@ -24,7 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
- android:layout_toRightOf="@+id/rl_back"
+ android:layout_toEndOf="@id/rl_back"
android:textColor="@android:color/white"
android:textSize="20sp"
tools:text="0/9" />
@@ -54,7 +54,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:layout_marginLeft="5dp"
+ android:layout_marginStart="5dp"
android:src="@drawable/vw_ic_arrow_down" />
@@ -63,7 +63,7 @@
android:id="@+id/rl_done"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
android:paddingLeft="10dp"
android:paddingRight="10dp">
@@ -81,7 +81,7 @@
android:id="@+id/rl_rec_aud"
android:layout_width="50dp"
android:layout_height="match_parent"
- android:layout_toLeftOf="@+id/rl_done"
+ android:layout_toStartOf="@+id/rl_done"
android:visibility="gone">
+
+ تم
+ لا يوجد تطبيق لتشغيل الفيديو!
+ تسجيل صوتي
+ تحتاج الي صلاحيات لاختيار الملفات
+ انت وصلت للحد الأقصي
+ لا يوجد تطبيق صور في هذا الهاتف!
+ لا يوجد تطبيق لتشغيل الصوت!
+ لا يوجد تطبيق فيديو في هذا الهاتف!
+ لا يوجد تطبيق صوت في هذا الهاتف!
+ الكل
+
\ No newline at end of file
diff --git a/filepicker/src/main/res/xml/file_paths.xml b/filepicker/src/main/res/xml/file_paths.xml
index ec07dbe..65599cc 100644
--- a/filepicker/src/main/res/xml/file_paths.xml
+++ b/filepicker/src/main/res/xml/file_paths.xml
@@ -1,6 +1,18 @@
+
+
+
+
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index aac7c9b..9e6fce1 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -9,6 +9,8 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
+android.enableJetifier=true
+android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index fb11b7a..2262edc 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Sat Jun 23 19:07:51 CST 2018
+#Sun May 10 22:25:03 EEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip