├── .gitignore
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── filepicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── filepicker
│ │ │ ├── FilePickerActivity.java
│ │ │ └── adapter
│ │ │ └── FilePickerAdapter.java
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── file_picker_layout_upload.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── filepicker
│ └── ExampleUnitTest.java
├── build.gradle
├── filepicker-audiopicker
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── audiopicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── audiopicker
│ │ │ ├── AudioPickerActivity.java
│ │ │ ├── adapter
│ │ │ └── AudioPickerAdapter.java
│ │ │ └── fragment
│ │ │ └── AudioPickerFragment.java
│ ├── manifest
│ │ └── AndroidManifest.xml
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_audio_picker.xml
│ │ ├── fragment_audio_picker.xml
│ │ └── item_audio_picker_audio.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── picker_select_checked.png
│ │ └── picker_select_unchecked.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── audiopicker
│ └── ExampleUnitTest.java
├── filepicker-common
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── common
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── common
│ │ │ ├── callback
│ │ │ ├── HandlerCallBack.java
│ │ │ └── IHandlerCallBack.java
│ │ │ ├── config
│ │ │ └── FilePickerConfig.java
│ │ │ └── imageloader
│ │ │ ├── GlideImageLoader.java
│ │ │ └── ImageLoader.java
│ └── res
│ │ ├── layout
│ │ └── file_picker_layout_upload.xml
│ │ ├── mipmap-xhdpi
│ │ ├── repository_audio_ico.png
│ │ ├── repository_folder_ico.png
│ │ ├── repository_manuscripts_ico.png
│ │ ├── repository_picture_ico.png
│ │ ├── repository_unknown_ico.png
│ │ ├── repository_video_ico.png
│ │ └── repository_zipfile_ico.png
│ │ ├── mipmap-xxhdpi
│ │ ├── repository_audio_ico.png
│ │ ├── repository_folder_ico.png
│ │ ├── repository_manuscripts_ico.png
│ │ ├── repository_picture_ico.png
│ │ ├── repository_unknown_ico.png
│ │ ├── repository_video_ico.png
│ │ └── repository_zipfile_ico.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── common
│ └── ExampleUnitTest.java
├── filepicker-documentpicker
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── documentpicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── documentpicker
│ │ │ ├── DocumentPickerActivity.java
│ │ │ ├── adapter
│ │ │ └── DocumentPickerAdapter.java
│ │ │ └── fragment
│ │ │ └── DocumentPickerFragment.java
│ ├── manifest
│ │ └── AndroidManifest.xml
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_document_picker.xml
│ │ ├── fragment_document_picker.xml
│ │ └── item_document_picker_document.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── picker_select_checked.png
│ │ └── picker_select_unchecked.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── documentpicker
│ └── ExampleUnitTest.java
├── filepicker-folderpicker
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── folderpicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── folderpicker
│ │ │ ├── FolderPickerActivity.java
│ │ │ ├── adapter
│ │ │ └── FolderPickerAdapter.java
│ │ │ └── fragment
│ │ │ └── FolderPickerFragment.java
│ ├── manifest
│ │ └── AndroidManifest.xml
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_folder_picker.xml
│ │ ├── fragment_folder_picker.xml
│ │ └── item_folder_picker_document.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── picker_select_checked.png
│ │ └── picker_select_unchecked.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── folderpicker
│ └── ExampleUnitTest.java
├── filepicker-imagepicker
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── imagepicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── imagepicker
│ │ │ ├── ImagePickerActivity.java
│ │ │ ├── adapter
│ │ │ └── ImagePickerAdapter.java
│ │ │ └── fragment
│ │ │ └── ImagePickerFragment.java
│ ├── manifest
│ │ └── AndroidManifest.xml
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_image_picker.xml
│ │ ├── fragment_image_picker.xml
│ │ ├── item_image_picker_camera.xml
│ │ └── item_image_picker_photo.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── image_picker_camera.png
│ │ ├── picker_select_checked.png
│ │ └── picker_select_unchecked.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── imagepicker
│ └── ExampleUnitTest.java
├── filepicker-rarpicker
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── rarpicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── rarpicker
│ │ │ ├── RarPickerActivity.java
│ │ │ ├── adapter
│ │ │ └── RarPickerAdapter.java
│ │ │ └── fragment
│ │ │ └── RarPickerFragment.java
│ ├── manifest
│ │ └── AndroidManifest.xml
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_rar_picker.xml
│ │ ├── fragment_rar_picker.xml
│ │ └── item_rar_picker_rar.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── picker_select_checked.png
│ │ └── picker_select_unchecked.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── rarpicker
│ └── ExampleUnitTest.java
├── filepicker-searchfilelibrary
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── searchfilelibrary
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── searchfilelibrary
│ │ │ ├── FileService.java
│ │ │ ├── callback
│ │ │ └── GetListCallback.java
│ │ │ ├── config
│ │ │ └── SearchCofig.java
│ │ │ ├── entity
│ │ │ ├── AudioEntity.java
│ │ │ ├── DocumentEntity.java
│ │ │ ├── FolderEntity.java
│ │ │ ├── ImageEntity.java
│ │ │ ├── MediaEntity.java
│ │ │ ├── RarEntity.java
│ │ │ └── VideoEntity.java
│ │ │ ├── runnable
│ │ │ ├── ApkRunnable.java
│ │ │ ├── AudioRunnable.java
│ │ │ ├── DocumentRunnable.java
│ │ │ ├── FolderRunnable.java
│ │ │ ├── ImageRunnable.java
│ │ │ ├── RarRunnable.java
│ │ │ └── VideoRunnable.java
│ │ │ └── utils
│ │ │ ├── FileErgodicUtil.java
│ │ │ └── MediaStoreUtil.java
│ └── res
│ │ ├── values
│ │ └── strings.xml
│ │ └── xml
│ │ └── file_paths.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── searchfilelibrary
│ └── ExampleUnitTest.java
├── filepicker-videopicker
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhangteng
│ │ └── videopicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zhangteng
│ │ │ └── videopicker
│ │ │ ├── VideoPickerActivity.java
│ │ │ ├── adapter
│ │ │ └── VideoPickerAdapter.java
│ │ │ └── fragment
│ │ │ └── VideoPickerFragment.java
│ ├── manifest
│ │ └── AndroidManifest.xml
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_video_picker.xml
│ │ ├── fragment_video_picker.xml
│ │ ├── item_video_picker_camera.xml
│ │ └── item_video_picker_photo.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── picker_select_checked.png
│ │ ├── picker_select_unchecked.png
│ │ └── video_picker_camera.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zhangteng
│ └── videopicker
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── readme.md
├── screenshot
├── 20200807160902112.jpg
├── 20200807160902219.jpg
├── 20200914093052474.png
├── 20200914093222160.png
└── 20200914093256824.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | .DS_Store
5 | /build
6 | /captures
7 | .externalNativeBuild
8 | /.idea
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 32
5 | defaultConfig {
6 | applicationId "com.zhangteng.filepicker"
7 | minSdkVersion 21
8 | //noinspection ExpiredTargetSdkVersion
9 | targetSdkVersion 32
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | compileOptions {
21 | sourceCompatibility JavaVersion.VERSION_1_8
22 | targetCompatibility JavaVersion.VERSION_1_8
23 | }
24 | }
25 |
26 | dependencies {
27 | implementation fileTree(include: ['*.jar'], dir: 'libs')
28 | implementation 'androidx.appcompat:appcompat:1.4.1'
29 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
30 | implementation 'com.google.android.material:material:1.4.0'
31 | testImplementation 'junit:junit:4.13.2'
32 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
34 |
35 | if (!isRunAlone.toBoolean()) {
36 | implementation project(':filepicker-audiopicker')
37 | implementation project(':filepicker-documentpicker')
38 | implementation project(':filepicker-folderpicker')
39 | implementation project(':filepicker-imagepicker')
40 | implementation project(':filepicker-rarpicker')
41 | implementation project(':filepicker-videopicker')
42 | }
43 | implementation project(':filepicker-searchfilelibrary')
44 | implementation project(':filepicker-common')
45 | // implementation 'com.github.DL-ZhangTeng.FilePicker:filepicker-audiopicker:1.2.0'
46 | // implementation 'com.github.DL-ZhangTeng.FilePicker:filepicker-documentpicker:1.2.0'
47 | // implementation 'com.github.DL-ZhangTeng.FilePicker:filepicker-folderpicker:1.2.0'
48 | // implementation 'com.github.DL-ZhangTeng.FilePicker:filepicker-imagepicker:1.2.0'
49 | // implementation 'com.github.DL-ZhangTeng.FilePicker:filepicker-rarpicker:1.2.0'
50 | // implementation 'com.github.DL-ZhangTeng.FilePicker:filepicker-videopicker:1.2.0'
51 | // implementation 'com.github.DL-ZhangTeng.FilePicker:filepicker-searchfilelibrary:1.2.0'
52 | // implementation 'com.github.DL-ZhangTeng.FilePicker:filepicker-common:1.2.0'
53 | // 或直接使用implementation 'com.github.DL-ZhangTeng:FilePicker:1.2.0'
54 |
55 | implementation 'com.github.bumptech.glide:glide:4.12.0'
56 | annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
57 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.0'
58 | implementation('com.github.DL-ZhangTeng:BaseLibrary:2.0.1') {
59 | transitive false
60 | }
61 | implementation 'com.github.DL-ZhangTeng:Utils:2.0.1'
62 | }
63 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/zhangteng/filepicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.filepicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zhangteng.filepicker", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
17 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhangteng/filepicker/FilePickerActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.filepicker;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.widget.Toast;
6 |
7 | import androidx.appcompat.app.AppCompatActivity;
8 | import androidx.fragment.app.Fragment;
9 | import androidx.viewpager.widget.ViewPager;
10 |
11 | import com.zhangteng.androidpermission.AndroidPermission;
12 | import com.zhangteng.androidpermission.Permission;
13 | import com.zhangteng.androidpermission.callback.Callback;
14 | import com.zhangteng.audiopicker.fragment.AudioPickerFragment;
15 | import com.zhangteng.base.widget.MyTabLayout;
16 | import com.zhangteng.documentpicker.fragment.DocumentPickerFragment;
17 | import com.zhangteng.filepicker.adapter.FilePickerAdapter;
18 | import com.zhangteng.folderpicker.fragment.FolderPickerFragment;
19 | import com.zhangteng.imagepicker.fragment.ImagePickerFragment;
20 | import com.zhangteng.rarpicker.fragment.RarPickerFragment;
21 | import com.zhangteng.videopicker.fragment.VideoPickerFragment;
22 |
23 | import java.util.ArrayList;
24 |
25 | public class FilePickerActivity extends AppCompatActivity {
26 | private final ArrayList fragments = new ArrayList();
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_main);
32 | MyTabLayout myTabLayout = findViewById(R.id.mytablayout);
33 | ViewPager viewPager = findViewById(R.id.viewpager);
34 |
35 | fragments.add(new ImagePickerFragment());
36 | fragments.add(new VideoPickerFragment());
37 | fragments.add(new AudioPickerFragment());
38 | fragments.add(new RarPickerFragment());
39 | fragments.add(new DocumentPickerFragment());
40 | fragments.add(new FolderPickerFragment());
41 |
42 | AndroidPermission androidPermission = new AndroidPermission.Buidler()
43 | .with(FilePickerActivity.this)
44 | .permission(Permission.Group.STORAGE_R)
45 | .callback(new Callback() {
46 | @Override
47 | public void success(Activity permissionActivity) {
48 | FilePickerAdapter filePickerAdapter = new FilePickerAdapter(getSupportFragmentManager(), fragments);
49 | viewPager.setAdapter(filePickerAdapter);
50 | viewPager.setOffscreenPageLimit(5);
51 | myTabLayout.setupWithViewPager(viewPager);
52 | }
53 |
54 | @Override
55 | public void failure(Activity permissionActivity) {
56 | Toast.makeText(FilePickerActivity.this, "请开启相机权限!", Toast.LENGTH_SHORT).show();
57 | }
58 |
59 | @Override
60 | public void nonExecution(Activity permissionActivity) {
61 | //权限已通过,请求未执行
62 | success(permissionActivity);
63 | }
64 | })
65 | .build();
66 | androidPermission.execute();
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhangteng/filepicker/adapter/FilePickerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.filepicker.adapter;
2 |
3 | import androidx.fragment.app.Fragment;
4 | import androidx.fragment.app.FragmentManager;
5 | import androidx.fragment.app.FragmentPagerAdapter;
6 |
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * Created by Swing on 2017/11/24.
11 | */
12 |
13 | public class FilePickerAdapter extends FragmentPagerAdapter {
14 | private final String[] titles = {"图片", "视频", "音频", "压缩包", "文档", "文件"};
15 | private final ArrayList fragments;
16 |
17 | public FilePickerAdapter(FragmentManager fm, ArrayList fragments) {
18 | super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
19 | this.fragments = fragments;
20 | }
21 |
22 | @Override
23 | public Fragment getItem(int position) {
24 | return fragments.get(position);
25 | }
26 |
27 | @Override
28 | public CharSequence getPageTitle(int position) {
29 | return titles[position];
30 | }
31 |
32 | @Override
33 | public int getCount() {
34 | return titles.length;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
21 |
22 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/file_picker_layout_upload.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
27 |
28 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FilePicker
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/test/java/com/zhangteng/filepicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.filepicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | maven { url 'https://jitpack.io' }
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:4.2.2'
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | maven { url 'https://jitpack.io' }
23 | }
24 | //此处添加的UTF-8格式
25 | tasks.withType(Javadoc) {
26 | options.addStringOption('Xdoclint:none', '-quiet')
27 | options.addStringOption('encoding', 'UTF-8')
28 | }
29 | }
30 |
31 | task clean(type: Delete) {
32 | delete rootProject.buildDir
33 | }
34 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/build.gradle:
--------------------------------------------------------------------------------
1 | if(isRunAlone.toBoolean()){
2 | apply plugin: 'com.android.application'
3 | }else{
4 | apply plugin:'com.android.library'
5 | }
6 |
7 | android {
8 | compileSdkVersion 32
9 |
10 |
11 |
12 | defaultConfig {
13 | if (isRunAlone.toBoolean()) {
14 | applicationId "com.zhangteng.audiopicker"
15 | }
16 | minSdkVersion 21
17 | //noinspection ExpiredTargetSdkVersion
18 | targetSdkVersion 32
19 | versionCode 1
20 | versionName "1.0"
21 |
22 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
23 |
24 | }
25 |
26 | buildTypes {
27 | release {
28 | minifyEnabled false
29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 |
33 | sourceSets {
34 | main {
35 | if (isRunAlone.toBoolean()) {
36 | manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
37 | } else {
38 | manifest.srcFile 'src/main/AndroidManifest.xml'
39 | }
40 | }
41 | }
42 | compileOptions {
43 | sourceCompatibility JavaVersion.VERSION_1_8
44 | targetCompatibility JavaVersion.VERSION_1_8
45 | }
46 | }
47 |
48 | dependencies {
49 | implementation fileTree(include: ['*.jar'], dir: 'libs')
50 | implementation 'androidx.appcompat:appcompat:1.4.1'
51 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
52 | implementation 'com.google.android.material:material:1.4.0'
53 | testImplementation 'junit:junit:4.13.2'
54 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
55 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
56 |
57 | implementation project(':filepicker-searchfilelibrary')
58 | implementation project(':filepicker-common')
59 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.0'
60 | implementation 'com.github.DL-ZhangTeng:Utils:2.0.1'
61 | }
--------------------------------------------------------------------------------
/filepicker-audiopicker/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/androidTest/java/com/zhangteng/audiopicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.audiopicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zhangteng.audiopicker.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/java/com/zhangteng/audiopicker/AudioPickerActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.audiopicker;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 |
8 | public class AudioPickerActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_audio_picker);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/manifest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/layout/activity_audio_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/layout/fragment_audio_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
20 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/layout/item_audio_picker_audio.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
17 |
18 |
28 |
29 |
40 |
41 |
53 |
54 |
59 |
60 |
61 |
62 |
70 |
71 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-xhdpi/picker_select_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-xhdpi/picker_select_checked.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-audiopicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 | #88000000
9 |
10 | #FF343535
11 |
12 |
13 | #f7eee3
14 |
15 | #FFDCDCDC
16 |
17 | #FF999999
18 |
19 | #FF333333
20 |
21 |
22 | #FFFFFFFF
23 | #00E9C4
24 |
25 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AudioPicker
3 |
4 | %d 个音频已选择
5 | 录制音频
6 | 文件夹名
7 | %d 首
8 | %d KB
9 |
10 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/filepicker-audiopicker/src/test/java/com/zhangteng/audiopicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.audiopicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/filepicker-common/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/filepicker-common/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 32
5 |
6 | defaultConfig {
7 | minSdkVersion 21
8 | //noinspection ExpiredTargetSdkVersion
9 | targetSdkVersion 32
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
14 | consumerProguardFiles "consumer-rules.pro"
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | compileOptions {
24 | sourceCompatibility JavaVersion.VERSION_1_8
25 | targetCompatibility JavaVersion.VERSION_1_8
26 | }
27 | }
28 |
29 | dependencies {
30 | implementation fileTree(dir: "libs", include: ["*.jar"])
31 | implementation 'androidx.appcompat:appcompat:1.4.1'
32 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
33 | implementation 'com.google.android.material:material:1.4.0'
34 | testImplementation 'junit:junit:4.13.2'
35 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
36 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
37 |
38 | implementation project(':filepicker-searchfilelibrary')
39 | implementation 'com.github.bumptech.glide:glide:4.12.0'
40 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.0'
41 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.0'
42 | }
--------------------------------------------------------------------------------
/filepicker-common/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/consumer-rules.pro
--------------------------------------------------------------------------------
/filepicker-common/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/filepicker-common/src/androidTest/java/com/zhangteng/common/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.common;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23 | assertEquals("com.zhangteng.common.test", appContext.getPackageName());
24 | }
25 | }
--------------------------------------------------------------------------------
/filepicker-common/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/java/com/zhangteng/common/callback/HandlerCallBack.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.common.callback;
2 |
3 | import android.util.Log;
4 |
5 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by swing on 2018/4/18.
11 | */
12 | public class HandlerCallBack implements IHandlerCallBack {
13 | private String TAG = "---ImagePicker---";
14 |
15 | @Override
16 | public void onStart() {
17 | Log.i(TAG, "onStart: 开启");
18 | }
19 |
20 | @Override
21 | public void onSuccess(List audioList) {
22 | Log.i(TAG, "onSuccess: 返回数据");
23 | }
24 |
25 | @Override
26 | public void onCancel() {
27 | Log.i(TAG, "onCancel: 取消");
28 | }
29 |
30 | @Override
31 | public void onFinish(List selectAudio) {
32 | Log.i(TAG, "onFinish: 结束");
33 | }
34 |
35 | @Override
36 | public void onError() {
37 | Log.i(TAG, "onError: 出错");
38 | }
39 |
40 | @Override
41 | public void onPreview(List selectAudio) {
42 | Log.i(TAG, "onPreview: 预览");
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/java/com/zhangteng/common/callback/IHandlerCallBack.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.common.callback;
2 |
3 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by swing on 2018/4/18.
9 | */
10 | public interface IHandlerCallBack {
11 |
12 | void onStart();
13 |
14 | void onSuccess(List selectAudio);
15 |
16 | void onCancel();
17 |
18 | void onFinish(List selectAudio);
19 |
20 | void onError();
21 |
22 | void onPreview(List selectAudio);
23 | }
24 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/java/com/zhangteng/common/imageloader/GlideImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.common.imageloader;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.widget.ImageView;
6 |
7 | import androidx.annotation.DrawableRes;
8 |
9 | import com.bumptech.glide.Glide;
10 | import com.bumptech.glide.request.RequestOptions;
11 |
12 | /**
13 | * Created by swing on 2018/4/18.
14 | */
15 | public class GlideImageLoader implements ImageLoader {
16 | private int placeHolder;
17 |
18 | public GlideImageLoader placeholder(@DrawableRes int placeHolder) {
19 | this.placeHolder = placeHolder;
20 | return this;
21 | }
22 |
23 | @Override
24 | public void loadImage(Context context, ImageView imageView, Bitmap uri) {
25 | Glide.with(context)
26 | .load(uri)
27 | .apply(new RequestOptions()
28 | .centerCrop()
29 | .placeholder(placeHolder))
30 | .into(imageView);
31 |
32 | }
33 |
34 | @Override
35 | public void loadImage(Context context, ImageView imageView, String path) {
36 | Glide.with(context)
37 | .load(path)
38 | .apply(new RequestOptions()
39 | .centerCrop()
40 | .placeholder(placeHolder))
41 | .into(imageView);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/java/com/zhangteng/common/imageloader/ImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.common.imageloader;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.widget.ImageView;
6 |
7 | /**
8 | * Created by swing on 2018/4/18.
9 | */
10 | public interface ImageLoader {
11 | void loadImage(Context context, ImageView imageView, Bitmap uri);
12 |
13 | void loadImage(Context context, ImageView imageView, String path);
14 | }
15 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/layout/file_picker_layout_upload.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
27 |
28 |
38 |
39 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xhdpi/repository_audio_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xhdpi/repository_audio_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xhdpi/repository_folder_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xhdpi/repository_folder_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xhdpi/repository_manuscripts_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xhdpi/repository_manuscripts_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xhdpi/repository_picture_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xhdpi/repository_picture_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xhdpi/repository_unknown_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xhdpi/repository_unknown_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xhdpi/repository_video_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xhdpi/repository_video_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xhdpi/repository_zipfile_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xhdpi/repository_zipfile_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xxhdpi/repository_audio_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xxhdpi/repository_audio_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xxhdpi/repository_folder_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xxhdpi/repository_folder_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xxhdpi/repository_manuscripts_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xxhdpi/repository_manuscripts_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xxhdpi/repository_picture_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xxhdpi/repository_picture_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xxhdpi/repository_unknown_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xxhdpi/repository_unknown_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xxhdpi/repository_video_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xxhdpi/repository_video_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/mipmap-xxhdpi/repository_zipfile_ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-common/src/main/res/mipmap-xxhdpi/repository_zipfile_ico.png
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #00E9C4
7 |
8 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 48dp
5 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BaseLibrary
3 |
4 |
5 |
--------------------------------------------------------------------------------
/filepicker-common/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
21 |
22 |
--------------------------------------------------------------------------------
/filepicker-common/src/test/java/com/zhangteng/common/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.common;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/filepicker-documentpicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/build.gradle:
--------------------------------------------------------------------------------
1 | if (isRunAlone.toBoolean()) {
2 | apply plugin: 'com.android.application'
3 | } else {
4 | apply plugin: 'com.android.library'
5 | }
6 | android {
7 | compileSdkVersion 32
8 |
9 |
10 | defaultConfig {
11 | if (isRunAlone.toBoolean()) {
12 | applicationId "com.zhangteng.documentpicker"
13 | }
14 | minSdkVersion 21
15 | //noinspection ExpiredTargetSdkVersion
16 | targetSdkVersion 32
17 | versionCode 1
18 | versionName "1.0"
19 |
20 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
21 |
22 | }
23 |
24 | buildTypes {
25 | release {
26 | minifyEnabled false
27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 | sourceSets {
31 | main {
32 | if (isRunAlone.toBoolean()) {
33 | manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
34 | } else {
35 | manifest.srcFile 'src/main/AndroidManifest.xml'
36 | }
37 | }
38 | }
39 | compileOptions {
40 | sourceCompatibility JavaVersion.VERSION_1_8
41 | targetCompatibility JavaVersion.VERSION_1_8
42 | }
43 | }
44 |
45 | dependencies {
46 | implementation fileTree(include: ['*.jar'], dir: 'libs')
47 | implementation 'androidx.appcompat:appcompat:1.4.1'
48 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
49 | implementation 'com.google.android.material:material:1.4.0'
50 | testImplementation 'junit:junit:4.13.2'
51 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
52 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
53 |
54 | implementation project(':filepicker-searchfilelibrary')
55 | implementation project(':filepicker-common')
56 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.0'
57 | implementation 'com.github.DL-ZhangTeng:Utils:2.0.1'
58 | }
--------------------------------------------------------------------------------
/filepicker-documentpicker/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/androidTest/java/com/zhangteng/documentpicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.documentpicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zhangteng.documentpicker.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/java/com/zhangteng/documentpicker/DocumentPickerActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.documentpicker;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 | public class DocumentPickerActivity extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_document_picker);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/manifest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/layout/activity_document_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/layout/fragment_document_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
20 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/layout/item_document_picker_document.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
17 |
18 |
28 |
29 |
40 |
41 |
53 |
54 |
59 |
60 |
61 |
62 |
70 |
71 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-xhdpi/picker_select_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-xhdpi/picker_select_checked.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-documentpicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 | #88000000
9 |
10 | #FF343535
11 |
12 |
13 | #f7eee3
14 |
15 | #FFDCDCDC
16 |
17 | #FF999999
18 |
19 | #FF333333
20 |
21 |
22 | #FFFFFFFF
23 | #00E9C4
24 |
25 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DocumentPicker
3 |
4 | %d 个文档已选择
5 | 文件夹名
6 | %d 个
7 | %d KB
8 |
9 |
10 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/filepicker-documentpicker/src/test/java/com/zhangteng/documentpicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.documentpicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/filepicker-folderpicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/build.gradle:
--------------------------------------------------------------------------------
1 | if(isRunAlone.toBoolean()){
2 | apply plugin: 'com.android.application'
3 | }else{
4 | apply plugin:'com.android.library'
5 | }
6 |
7 | android {
8 | compileSdkVersion 32
9 |
10 |
11 |
12 | defaultConfig {
13 | if (isRunAlone.toBoolean()) {
14 | applicationId "com.zhangteng.folderpicker"
15 | }
16 | minSdkVersion 21
17 | //noinspection ExpiredTargetSdkVersion
18 | targetSdkVersion 32
19 | versionCode 1
20 | versionName "1.0"
21 |
22 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
23 |
24 | }
25 |
26 | buildTypes {
27 | release {
28 | minifyEnabled false
29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 | sourceSets {
33 | main {
34 | if (isRunAlone.toBoolean()) {
35 | manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
36 | } else {
37 | manifest.srcFile 'src/main/AndroidManifest.xml'
38 | }
39 | }
40 | }
41 | compileOptions {
42 | sourceCompatibility JavaVersion.VERSION_1_8
43 | targetCompatibility JavaVersion.VERSION_1_8
44 | }
45 | }
46 |
47 | dependencies {
48 | implementation fileTree(include: ['*.jar'], dir: 'libs')
49 | implementation 'androidx.appcompat:appcompat:1.4.1'
50 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
51 | implementation 'com.google.android.material:material:1.4.0'
52 | testImplementation 'junit:junit:4.13.2'
53 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
54 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
55 |
56 | implementation project(':filepicker-searchfilelibrary')
57 | implementation project(':filepicker-common')
58 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.+'
59 | implementation 'com.github.DL-ZhangTeng:Utils:1.0.+'
60 | }
--------------------------------------------------------------------------------
/filepicker-folderpicker/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/androidTest/java/com/zhangteng/folderpicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.folderpicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zhangteng.folderpicker.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/java/com/zhangteng/folderpicker/FolderPickerActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.folderpicker;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 | public class FolderPickerActivity extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_folder_picker);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/manifest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/layout/activity_folder_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/layout/fragment_folder_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
20 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/layout/item_folder_picker_document.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
17 |
18 |
28 |
29 |
40 |
41 |
53 |
54 |
59 |
60 |
61 |
62 |
70 |
71 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-xhdpi/picker_select_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-xhdpi/picker_select_checked.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-folderpicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 | #88000000
9 |
10 | #FF343535
11 |
12 |
13 | #f7eee3
14 |
15 | #FFDCDCDC
16 |
17 | #FF999999
18 |
19 | #FF333333
20 |
21 |
22 | #FFFFFFFF
23 | #00E9C4
24 |
25 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FolderPicker
3 |
4 | %d 个文件已选择
5 | 文件夹名
6 | %d 个
7 | %d KB
8 |
9 |
10 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/filepicker-folderpicker/src/test/java/com/zhangteng/folderpicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.folderpicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/filepicker-imagepicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/build.gradle:
--------------------------------------------------------------------------------
1 | if(isRunAlone.toBoolean()){
2 | apply plugin: 'com.android.application'
3 | }else{
4 | apply plugin:'com.android.library'
5 | }
6 |
7 |
8 | android {
9 | compileSdkVersion 32
10 |
11 |
12 |
13 | defaultConfig {
14 | if (isRunAlone.toBoolean()) {
15 | applicationId "com.zhangteng.imagepicker"
16 | }
17 | minSdkVersion 21
18 | //noinspection ExpiredTargetSdkVersion
19 | targetSdkVersion 32
20 | versionCode 1
21 | versionName "1.0"
22 |
23 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
24 |
25 | }
26 |
27 | buildTypes {
28 | release {
29 | minifyEnabled false
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 | }
32 | }
33 | sourceSets {
34 | main {
35 | if (isRunAlone.toBoolean()) {
36 | manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
37 | } else {
38 | manifest.srcFile 'src/main/AndroidManifest.xml'
39 | }
40 | }
41 | }
42 | compileOptions {
43 | sourceCompatibility JavaVersion.VERSION_1_8
44 | targetCompatibility JavaVersion.VERSION_1_8
45 | }
46 | }
47 |
48 | dependencies {
49 | implementation fileTree(include: ['*.jar'], dir: 'libs')
50 | implementation 'androidx.appcompat:appcompat:1.4.1'
51 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
52 | implementation 'com.google.android.material:material:1.4.0'
53 | testImplementation 'junit:junit:4.13.2'
54 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
55 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
56 |
57 | implementation project(':filepicker-searchfilelibrary')
58 | implementation project(':filepicker-common')
59 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.0'
60 | implementation 'com.github.DL-ZhangTeng:Utils:2.0.1'
61 | }
--------------------------------------------------------------------------------
/filepicker-imagepicker/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/androidTest/java/com/zhangteng/imagepicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.imagepicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zhangteng.imagepicker.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/java/com/zhangteng/imagepicker/ImagePickerActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.imagepicker;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 | public class ImagePickerActivity extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_image_picker);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/manifest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/layout/activity_image_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/layout/fragment_image_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
20 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/layout/item_image_picker_camera.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/layout/item_image_picker_photo.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
23 |
24 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xhdpi/image_picker_camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xhdpi/image_picker_camera.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xhdpi/picker_select_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xhdpi/picker_select_checked.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-imagepicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 | #88000000
9 |
10 | #FF343535
11 |
12 |
13 | #f7eee3
14 |
15 | #FFDCDCDC
16 |
17 | #FF999999
18 |
19 | #FF333333
20 |
21 |
22 | #FFFFFFFF
23 | #00E9C4
24 |
25 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ImagePicker
3 |
4 | %d 个图片已选择
5 | 拍摄照片
6 |
7 |
8 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/filepicker-imagepicker/src/test/java/com/zhangteng/imagepicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.imagepicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/filepicker-rarpicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/build.gradle:
--------------------------------------------------------------------------------
1 | if (isRunAlone.toBoolean()) {
2 | apply plugin: 'com.android.application'
3 | } else {
4 | apply plugin: 'com.android.library'
5 | }
6 |
7 |
8 | android {
9 | compileSdkVersion 32
10 |
11 |
12 |
13 | defaultConfig {
14 | if (isRunAlone.toBoolean()) {
15 | applicationId "com.zhangteng.rarpicker"
16 | }
17 | minSdkVersion 21
18 | //noinspection ExpiredTargetSdkVersion
19 | targetSdkVersion 32
20 | versionCode 1
21 | versionName "1.0"
22 |
23 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
24 |
25 | }
26 |
27 | buildTypes {
28 | release {
29 | minifyEnabled false
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 | }
32 | }
33 | sourceSets {
34 | main {
35 | if (isRunAlone.toBoolean()) {
36 | manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
37 | } else {
38 | manifest.srcFile 'src/main/AndroidManifest.xml'
39 | }
40 | }
41 | }
42 | compileOptions {
43 | sourceCompatibility JavaVersion.VERSION_1_8
44 | targetCompatibility JavaVersion.VERSION_1_8
45 | }
46 | }
47 |
48 | dependencies {
49 | implementation fileTree(include: ['*.jar'], dir: 'libs')
50 | implementation 'androidx.appcompat:appcompat:1.4.1'
51 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
52 | implementation 'com.google.android.material:material:1.4.0'
53 | testImplementation 'junit:junit:4.13.2'
54 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
55 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
56 |
57 | implementation project(':filepicker-searchfilelibrary')
58 | implementation project(':filepicker-common')
59 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.0'
60 | implementation 'com.github.DL-ZhangTeng:Utils:2.0.1'
61 | }
--------------------------------------------------------------------------------
/filepicker-rarpicker/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/androidTest/java/com/zhangteng/rarpicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.rarpicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zhangteng.rarpicker.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/java/com/zhangteng/rarpicker/RarPickerActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.rarpicker;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 | public class RarPickerActivity extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_rar_picker);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/manifest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/layout/activity_rar_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/layout/fragment_rar_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
19 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/layout/item_rar_picker_rar.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
17 |
18 |
28 |
29 |
40 |
41 |
53 |
54 |
59 |
60 |
61 |
62 |
70 |
71 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-xhdpi/picker_select_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-xhdpi/picker_select_checked.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-rarpicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 | #88000000
9 |
10 | #FF343535
11 |
12 |
13 | #f7eee3
14 |
15 | #FFDCDCDC
16 |
17 | #FF999999
18 |
19 | #FF333333
20 |
21 |
22 | #FFFFFFFF
23 | #00E9C4
24 |
25 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RarPicker
3 |
4 | %d 个文件已选择
5 | 文件夹名
6 | %d 个
7 | %d KB
8 |
9 |
10 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/filepicker-rarpicker/src/test/java/com/zhangteng/rarpicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.rarpicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 32
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 21
10 | //noinspection ExpiredTargetSdkVersion
11 | targetSdkVersion 32
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
16 |
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 |
34 | implementation 'androidx.appcompat:appcompat:1.4.1'
35 | testImplementation 'junit:junit:4.13.2'
36 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
38 | }
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/androidTest/java/com/zhangteng/searchfilelibrary/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zhangteng.searchfilelibrary.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
13 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/callback/GetListCallback.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.callback;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by swing on 2018/8/27.
7 | */
8 | public interface GetListCallback {
9 | int SUCCESS = 100;
10 | int FAILED = 101;
11 |
12 | void onSuccess(List list);
13 |
14 | void onFailed(String msg);
15 | }
16 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/config/SearchCofig.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.config;
2 |
3 | import android.os.Environment;
4 |
5 | /**
6 | * Created by swing on 2018/8/27.
7 | */
8 | public class SearchCofig {
9 | public static final String BASE_SD_PATH = Environment.getExternalStorageDirectory().getAbsolutePath();
10 | public static String EXTERNAL_SD = BASE_SD_PATH;
11 | /**
12 | * 外置存储弹出
13 | */
14 | public static String SDCARD_OUT_BROADCAST = "SEARCH_FILE_LIBRARAY_SDCARD_OUT_BROADCAST";
15 | /**
16 | * 外置存储插入
17 | */
18 | public static String SDCARD_IN_BROADCAST = "SEARCH_FILE_LIBRARAY_SDCARD_IN_BROADCAST";
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/entity/AudioEntity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.entity;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * 音频类型
7 | * Created by swing on 2018/8/27.
8 | */
9 | public class AudioEntity implements MediaEntity {
10 |
11 | String fileName;
12 | String filePath;
13 | long fileLength;
14 | int type;
15 | int time;
16 | String artist;
17 | String album;
18 | long updateTime;
19 |
20 | public AudioEntity() {
21 | }
22 |
23 | public AudioEntity(String fileName, String filePath, long fileLength, int type, long updateTime) {
24 | this.fileName = fileName;
25 | this.filePath = filePath;
26 | this.fileLength = fileLength;
27 | this.type = type;
28 | this.updateTime = updateTime;
29 | }
30 |
31 | public AudioEntity(String fileName, String filePath, long fileLength, int type, int time, String artist, String album, long updateTime) {
32 | this.fileName = fileName;
33 | this.filePath = filePath;
34 | this.fileLength = fileLength;
35 | this.type = type;
36 | this.time = time;
37 | this.artist = artist;
38 | this.album = album;
39 | this.updateTime = updateTime;
40 | }
41 |
42 | @Override
43 | public String getArtist() {
44 | return artist;
45 | }
46 |
47 | @Override
48 | public void setArtist(String artist) {
49 | this.artist = artist;
50 | }
51 |
52 | @Override
53 | public long getUpdateTime() {
54 | return updateTime;
55 | }
56 |
57 | @Override
58 | public void setUpdateTime(long updateTime) {
59 | this.updateTime = updateTime;
60 | }
61 |
62 | @Override
63 | public String getAlbum() {
64 | return album;
65 | }
66 |
67 | @Override
68 | public void setAlbum(String album) {
69 | this.album = album;
70 | }
71 |
72 | @Override
73 | public int getMediaType() {
74 | return type;
75 | }
76 |
77 | @Override
78 | public void setMediaType(int type) {
79 | this.type = type;
80 | }
81 |
82 | @Override
83 | public String getFileName() {
84 | return fileName;
85 | }
86 |
87 | @Override
88 | public void setFileName(String fileName) {
89 | this.fileName = fileName;
90 | }
91 |
92 | @Override
93 | public String getFilePath() {
94 | return filePath;
95 | }
96 |
97 | @Override
98 | public void setFilePath(String filePath) {
99 | this.filePath = filePath;
100 | }
101 |
102 | @Override
103 | public long getFileLength() {
104 | return fileLength;
105 | }
106 |
107 | @Override
108 | public void setFileLength(long fileLength) {
109 | this.fileLength = fileLength;
110 | }
111 |
112 | @Override
113 | public int getTime() {
114 | return time;
115 | }
116 |
117 | @Override
118 | public void setTime(int time) {
119 | this.time = time;
120 | }
121 |
122 | @Override
123 | public Bitmap getThumPath() {
124 | return null;
125 | }
126 |
127 | @Override
128 | public void setThumPath(Bitmap bitmap) {
129 |
130 | }
131 |
132 | @Override
133 | public String toString() {
134 | return "ImageEntity{" +
135 | "fileName='" + fileName + '\'' +
136 | ", filePath='" + filePath + '\'' +
137 | ", fileLength=" + fileLength +
138 | '}';
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/entity/DocumentEntity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.entity;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * 文档类型
7 | * Created by swing on 2018/8/27.
8 | */
9 | public class DocumentEntity implements MediaEntity {
10 | String fileName;
11 | String filePath;
12 | long fileLength;
13 | int type;
14 | long updateTime;
15 |
16 | public DocumentEntity() {
17 | }
18 |
19 | public DocumentEntity(String fileName, String filePath, long fileLength, int type, long updateTime) {
20 | this.fileName = fileName;
21 | this.filePath = filePath;
22 | this.fileLength = fileLength;
23 | this.type = type;
24 | this.updateTime = updateTime;
25 | }
26 |
27 | public int getType() {
28 | return type;
29 | }
30 |
31 | public void setType(int type) {
32 | this.type = type;
33 | }
34 |
35 | @Override
36 | public int getMediaType() {
37 | return type;
38 | }
39 |
40 | @Override
41 | public void setMediaType(int type) {
42 | this.type = type;
43 | }
44 |
45 | @Override
46 | public String getFileName() {
47 | return fileName;
48 | }
49 |
50 | @Override
51 | public void setFileName(String fileName) {
52 | this.fileName = fileName;
53 | }
54 |
55 | @Override
56 | public String getFilePath() {
57 | return filePath;
58 | }
59 |
60 | @Override
61 | public void setFilePath(String filePath) {
62 | this.filePath = filePath;
63 | }
64 |
65 | @Override
66 | public long getFileLength() {
67 | return fileLength;
68 | }
69 |
70 | @Override
71 | public void setFileLength(long fileLength) {
72 | this.fileLength = fileLength;
73 | }
74 |
75 | @Override
76 | public Bitmap getThumPath() {
77 | return null;
78 | }
79 |
80 | @Override
81 | public void setThumPath(Bitmap bitmap) {
82 | }
83 |
84 | @Override
85 | public String getAlbum() {
86 | return null;
87 | }
88 |
89 | @Override
90 | public void setAlbum(String album) {
91 |
92 | }
93 |
94 | @Override
95 | public int getTime() {
96 | return 0;
97 | }
98 |
99 | @Override
100 | public void setTime(int time) {
101 |
102 | }
103 |
104 | @Override
105 | public String getArtist() {
106 | return null;
107 | }
108 |
109 | @Override
110 | public void setArtist(String artist) {
111 |
112 | }
113 |
114 | @Override
115 | public long getUpdateTime() {
116 | return updateTime;
117 | }
118 |
119 | @Override
120 | public void setUpdateTime(long updateTime) {
121 | this.updateTime = updateTime;
122 | }
123 |
124 | @Override
125 | public String toString() {
126 | return "ImageEntity{" +
127 | "fileName='" + fileName + '\'' +
128 | ", filePath='" + filePath + '\'' +
129 | ", fileLength=" + fileLength +
130 | '}';
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/entity/FolderEntity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.entity;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by swing on 2018/9/11.
9 | */
10 | public class FolderEntity implements MediaEntity {
11 |
12 | String fileName;
13 | String filePath;
14 | int type;
15 | long updateTime;
16 | List children;
17 | FolderEntity parent;
18 |
19 | public FolderEntity(String fileName, String filePath, int type) {
20 | this.fileName = fileName;
21 | this.filePath = filePath;
22 | this.type = type;
23 | }
24 |
25 | public FolderEntity(String fileName, String filePath, int type, long updateTime) {
26 | this.fileName = fileName;
27 | this.filePath = filePath;
28 | this.type = type;
29 | this.updateTime = updateTime;
30 | }
31 |
32 | public FolderEntity getParent() {
33 | return parent;
34 | }
35 |
36 | public void setParent(FolderEntity parent) {
37 | this.parent = parent;
38 | }
39 |
40 | public List getChildren() {
41 | return children;
42 | }
43 |
44 | public void setChildren(List children) {
45 | this.children = children;
46 | }
47 |
48 | @Override
49 | public int getMediaType() {
50 | return type;
51 | }
52 |
53 | @Override
54 | public void setMediaType(int type) {
55 | this.type = type;
56 | }
57 |
58 | @Override
59 | public String getFileName() {
60 | return fileName;
61 | }
62 |
63 | @Override
64 | public void setFileName(String fileName) {
65 | this.fileName = fileName;
66 | }
67 |
68 | @Override
69 | public String getFilePath() {
70 | return filePath;
71 | }
72 |
73 | @Override
74 | public void setFilePath(String filePath) {
75 | this.filePath = filePath;
76 | }
77 |
78 | @Override
79 | public long getFileLength() {
80 | return 0;
81 | }
82 |
83 | @Override
84 | public void setFileLength(long fileLength) {
85 |
86 | }
87 |
88 | @Override
89 | public Bitmap getThumPath() {
90 | return null;
91 | }
92 |
93 | @Override
94 | public void setThumPath(Bitmap bitmap) {
95 |
96 | }
97 |
98 | @Override
99 | public String getAlbum() {
100 | return null;
101 | }
102 |
103 | @Override
104 | public void setAlbum(String album) {
105 |
106 | }
107 |
108 | @Override
109 | public int getTime() {
110 | return 0;
111 | }
112 |
113 | @Override
114 | public void setTime(int time) {
115 |
116 | }
117 |
118 | @Override
119 | public String getArtist() {
120 | return null;
121 | }
122 |
123 | @Override
124 | public void setArtist(String artist) {
125 |
126 | }
127 |
128 | @Override
129 | public long getUpdateTime() {
130 | return updateTime;
131 | }
132 |
133 | @Override
134 | public void setUpdateTime(long updateTime) {
135 | this.updateTime = updateTime;
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/entity/ImageEntity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.entity;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * 图片类型
7 | * Created by swing on 2018/8/27.
8 | */
9 | public class ImageEntity implements MediaEntity {
10 |
11 | String fileName;
12 | String filePath;
13 | long fileLength;
14 | int type;
15 | long updateTime;
16 |
17 | public ImageEntity() {
18 | }
19 |
20 | public ImageEntity(String fileName, String filePath, long fileLength, int type) {
21 | this.fileName = fileName;
22 | this.filePath = filePath;
23 | this.fileLength = fileLength;
24 | this.type = type;
25 | }
26 |
27 | public ImageEntity(String fileName, String filePath, long fileLength, int type, long updateTime) {
28 | this.fileName = fileName;
29 | this.filePath = filePath;
30 | this.fileLength = fileLength;
31 | this.type = type;
32 | this.updateTime = updateTime;
33 | }
34 |
35 | @Override
36 | public int getMediaType() {
37 | return type;
38 | }
39 |
40 | @Override
41 | public void setMediaType(int type) {
42 | this.type = type;
43 | }
44 |
45 | @Override
46 | public String getFileName() {
47 | return fileName;
48 | }
49 |
50 | @Override
51 | public void setFileName(String fileName) {
52 | this.fileName = fileName;
53 | }
54 |
55 | @Override
56 | public String getFilePath() {
57 | return filePath;
58 | }
59 |
60 | @Override
61 | public void setFilePath(String filePath) {
62 | this.filePath = filePath;
63 | }
64 |
65 | @Override
66 | public long getFileLength() {
67 | return fileLength;
68 | }
69 |
70 | @Override
71 | public void setFileLength(long fileLength) {
72 | this.fileLength = fileLength;
73 | }
74 |
75 | @Override
76 | public Bitmap getThumPath() {
77 | return null;
78 | }
79 |
80 | @Override
81 | public void setThumPath(Bitmap bitmap) {
82 | }
83 |
84 | @Override
85 | public String getAlbum() {
86 | return null;
87 | }
88 |
89 | @Override
90 | public void setAlbum(String album) {
91 |
92 | }
93 |
94 | @Override
95 | public int getTime() {
96 | return 0;
97 | }
98 |
99 | @Override
100 | public void setTime(int time) {
101 |
102 | }
103 |
104 | @Override
105 | public String getArtist() {
106 | return null;
107 | }
108 |
109 | @Override
110 | public void setArtist(String artist) {
111 |
112 | }
113 |
114 | @Override
115 | public long getUpdateTime() {
116 | return updateTime;
117 | }
118 |
119 | @Override
120 | public void setUpdateTime(long updateTime) {
121 | this.updateTime = updateTime;
122 | }
123 |
124 | @Override
125 | public String toString() {
126 | return "ImageEntity{" +
127 | "fileName='" + fileName + '\'' +
128 | ", filePath='" + filePath + '\'' +
129 | ", fileLength=" + fileLength +
130 | '}';
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/entity/MediaEntity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.entity;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * Created by swing on 2018/8/27.
7 | */
8 | public interface MediaEntity {
9 | /**
10 | * 图片类型
11 | */
12 | public static final int MEDIA_IMAGE = 0;
13 | /**
14 | * 音频类型
15 | */
16 | public static final int MEDIA_AUDIO = 1;
17 | /**
18 | * 视频类型
19 | */
20 | public static final int MEDIA_VIDEO = 2;
21 | /**
22 | * 文档类型
23 | */
24 | public static final int MEDIA_DOCUMENT = 3;
25 | /**
26 | * 压缩类型
27 | */
28 | public static final int MEDIA_ZIP = 4;
29 | /**
30 | * pdf类型
31 | */
32 | public static final int MEDIA_PDF = 5;
33 | /**
34 | * word类型
35 | */
36 | public static final int MEDIA_DOC = 6;
37 | /**
38 | * PPT类型
39 | */
40 | public static final int MEDIA_PPT = 7;
41 | /**
42 | * EXCEL类型
43 | */
44 | public static final int MEDIA_EXCEL = 8;
45 | /**
46 | * TXT类型
47 | */
48 | public static final int MEDIA_TXT = 9;
49 | /**
50 | * APK类型
51 | */
52 | public static final int MEDIA_APK = 10;
53 | /**
54 | * 文件夹类型
55 | */
56 | public static final int MEDIA_FOLDER = 99;
57 | /**
58 | * 未知类型
59 | */
60 | public static final int MEDIA_UNKNOWN = 100;
61 |
62 |
63 | public static String MEDIA_TYPE = "MEDIA_TYPE";
64 |
65 | /**
66 | * 获取文件的类型
67 | */
68 | int getMediaType();
69 |
70 | /**
71 | * 设置文件的类型
72 | */
73 | void setMediaType(int type);
74 |
75 | /***
76 | * 获取文件的名字
77 | *
78 | * @return
79 | */
80 | String getFileName();
81 |
82 | /***
83 | * 设置文件的名字
84 | *
85 | * @param fileName
86 | */
87 |
88 | void setFileName(String fileName);
89 |
90 | /***
91 | * 获取文件的路径
92 | *
93 | * @return
94 | */
95 | String getFilePath();
96 |
97 | /***
98 | * 设置文件的路径
99 | *
100 | * @param filePath
101 | */
102 | void setFilePath(String filePath);
103 |
104 | /***
105 | * 获取文件的大小
106 | *
107 | * @return
108 | */
109 | long getFileLength();
110 |
111 | /***
112 | * 设置文件的大小
113 | *
114 | * @param fileLength
115 | */
116 | void setFileLength(long fileLength);
117 |
118 | /***
119 | * 获取缩略图的路径
120 | *
121 | * @return
122 | */
123 | Bitmap getThumPath();
124 |
125 | /***
126 | * 设置缩略图的路径
127 | *
128 | * @param bitmap
129 | */
130 | void setThumPath(Bitmap bitmap);
131 |
132 | String getAlbum();
133 |
134 | void setAlbum(String album);
135 |
136 | int getTime();
137 |
138 | void setTime(int time);
139 |
140 | String getArtist();
141 |
142 | void setArtist(String artist);
143 |
144 | long getUpdateTime();
145 |
146 | void setUpdateTime(long updateTime);
147 | }
148 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/entity/RarEntity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.entity;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * 压缩文件
7 | * Created by swing on 2018/8/27.
8 | */
9 | public class RarEntity implements MediaEntity {
10 |
11 | String fileName;
12 | String filePath;
13 | long fileLength;
14 | int type;
15 | long updateTime;
16 |
17 | public RarEntity() {
18 | }
19 |
20 | public RarEntity(String fileName, String filePath, long fileLength, int type) {
21 | this.fileName = fileName;
22 | this.filePath = filePath;
23 | this.fileLength = fileLength;
24 | this.type = type;
25 | }
26 |
27 | public RarEntity(String fileName, String filePath, long fileLength, int type, long updateTime) {
28 | this.fileName = fileName;
29 | this.filePath = filePath;
30 | this.fileLength = fileLength;
31 | this.type = type;
32 | this.updateTime = updateTime;
33 | }
34 |
35 | @Override
36 | public int getMediaType() {
37 | return type;
38 | }
39 |
40 | @Override
41 | public void setMediaType(int type) {
42 | this.type = type;
43 | }
44 |
45 | @Override
46 | public String getFileName() {
47 | return fileName;
48 | }
49 |
50 | @Override
51 | public void setFileName(String fileName) {
52 | this.fileName = fileName;
53 | }
54 |
55 | @Override
56 | public String getFilePath() {
57 | return filePath;
58 | }
59 |
60 | @Override
61 | public void setFilePath(String filePath) {
62 | this.filePath = filePath;
63 | }
64 |
65 | @Override
66 | public long getFileLength() {
67 | return fileLength;
68 | }
69 |
70 | @Override
71 | public void setFileLength(long fileLength) {
72 | this.fileLength = fileLength;
73 | }
74 |
75 | @Override
76 | public Bitmap getThumPath() {
77 | return null;
78 | }
79 |
80 | @Override
81 | public void setThumPath(Bitmap bitmap) {
82 | }
83 |
84 | @Override
85 | public String getAlbum() {
86 | return null;
87 | }
88 |
89 | @Override
90 | public void setAlbum(String album) {
91 |
92 | }
93 |
94 | @Override
95 | public int getTime() {
96 | return 0;
97 | }
98 |
99 | @Override
100 | public void setTime(int time) {
101 |
102 | }
103 |
104 | @Override
105 | public String getArtist() {
106 | return null;
107 | }
108 |
109 | @Override
110 | public void setArtist(String artist) {
111 |
112 | }
113 |
114 | @Override
115 | public long getUpdateTime() {
116 | return updateTime;
117 | }
118 |
119 | @Override
120 | public void setUpdateTime(long updateTime) {
121 | this.updateTime = updateTime;
122 | }
123 |
124 | @Override
125 | public String toString() {
126 | return "ImageEntity{" +
127 | "fileName='" + fileName + '\'' +
128 | ", filePath='" + filePath + '\'' +
129 | ", fileLength=" + fileLength +
130 | '}';
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/entity/VideoEntity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.entity;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * 视频类型
7 | * Created by swing on 2018/8/27.
8 | */
9 | public class VideoEntity implements MediaEntity {
10 |
11 | String fileName;
12 | String filePath;
13 | long fileLength;
14 | int type;
15 | Bitmap thumbPath;
16 | long updateTime;
17 |
18 | public VideoEntity(String fileName, String filePath, long fileLength, int type, long updateTime) {
19 | this.fileName = fileName;
20 | this.filePath = filePath;
21 | this.fileLength = fileLength;
22 | this.type = type;
23 | this.updateTime = updateTime;
24 | }
25 |
26 | public VideoEntity(String fileName, String filePath, long fileLength, int type, Bitmap thumbPath) {
27 | this.thumbPath = thumbPath;
28 | this.fileName = fileName;
29 | this.filePath = filePath;
30 | this.fileLength = fileLength;
31 | this.type = type;
32 | }
33 |
34 | public VideoEntity() {
35 | }
36 |
37 | @Override
38 | public Bitmap getThumPath() {
39 | return thumbPath;
40 | }
41 |
42 | @Override
43 | public void setThumPath(Bitmap thumbPath) {
44 | this.thumbPath = thumbPath;
45 | }
46 |
47 | @Override
48 | public String getAlbum() {
49 | return null;
50 | }
51 |
52 | @Override
53 | public void setAlbum(String album) {
54 |
55 | }
56 |
57 | @Override
58 | public int getTime() {
59 | return 0;
60 | }
61 |
62 | @Override
63 | public void setTime(int time) {
64 |
65 | }
66 |
67 | @Override
68 | public String getArtist() {
69 | return null;
70 | }
71 |
72 | @Override
73 | public void setArtist(String artist) {
74 |
75 | }
76 |
77 | @Override
78 | public long getUpdateTime() {
79 | return updateTime;
80 | }
81 |
82 | @Override
83 | public void setUpdateTime(long updateTime) {
84 | this.updateTime = updateTime;
85 | }
86 |
87 | @Override
88 | public int getMediaType() {
89 | return type;
90 | }
91 |
92 | @Override
93 | public void setMediaType(int type) {
94 | this.type = type;
95 | }
96 |
97 | @Override
98 | public String getFileName() {
99 | return fileName;
100 | }
101 |
102 | @Override
103 | public void setFileName(String fileName) {
104 | this.fileName = fileName;
105 | }
106 |
107 | @Override
108 | public String getFilePath() {
109 | return filePath;
110 | }
111 |
112 | @Override
113 | public void setFilePath(String filePath) {
114 | this.filePath = filePath;
115 | }
116 |
117 | @Override
118 | public long getFileLength() {
119 | return fileLength;
120 | }
121 |
122 | @Override
123 | public void setFileLength(long fileLength) {
124 | this.fileLength = fileLength;
125 | }
126 |
127 | @Override
128 | public String toString() {
129 | return "ImageEntity{" +
130 | "fileName='" + fileName + '\'' +
131 | ", filePath='" + filePath + '\'' +
132 | ", fileLength=" + fileLength +
133 | '}';
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/runnable/ApkRunnable.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.runnable;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.os.Message;
6 | import android.util.Log;
7 |
8 | import com.zhangteng.searchfilelibrary.callback.GetListCallback;
9 | import com.zhangteng.searchfilelibrary.config.SearchCofig;
10 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
11 | import com.zhangteng.searchfilelibrary.entity.RarEntity;
12 | import com.zhangteng.searchfilelibrary.utils.MediaStoreUtil;
13 |
14 | import java.io.File;
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | import static com.zhangteng.searchfilelibrary.utils.MediaStoreUtil.MathFile;
19 |
20 | /**
21 | * Created by swing on 2018/8/27.
22 | */
23 | public class ApkRunnable implements Runnable {
24 | private Context context;
25 | private Handler handler;
26 |
27 | public ApkRunnable(Context context) {
28 | this.context = context;
29 | }
30 |
31 | public ApkRunnable(Handler handler) {
32 | this.handler = handler;
33 | }
34 |
35 | @Override
36 | public void run() {
37 | String[] zipName = new String[]{"apk"};
38 |
39 | if (handler != null) {
40 | getAllFiles(SearchCofig.BASE_SD_PATH, zipName, new GetListCallback() {
41 | @Override
42 | public void onSuccess(List list) {
43 | Message message = new Message();
44 | message.what = GetListCallback.SUCCESS;
45 | message.obj = list;
46 | handler.sendMessage(message);
47 | }
48 |
49 | @Override
50 | public void onFailed(String msg) {
51 | handler.sendEmptyMessage(GetListCallback.FAILED);
52 | }
53 | });
54 | return;
55 | }
56 | if (!MediaStoreUtil.getApk().isEmpty()) {
57 | MediaStoreUtil.clearApk();
58 | }
59 | getAllFiles(SearchCofig.BASE_SD_PATH, zipName, new GetListCallback() {
60 | @Override
61 | public void onSuccess(List list) {
62 | MediaStoreUtil.addApk(list);
63 | }
64 |
65 | @Override
66 | public void onFailed(String msg) {
67 | MediaStoreUtil.clearApk();
68 | }
69 | });
70 | }
71 |
72 | // 遍历相应的文件
73 | public List getAllFiles(String filePath, String[] endName, GetListCallback callBack) {
74 | List file_lists = new ArrayList();
75 | try {
76 | File root = new File(filePath);
77 | File files[] = root.listFiles();
78 | if (files != null) {
79 | for (File f : files) {
80 | if (f.isDirectory()) {
81 | //扫描结束后才会调用回调
82 | file_lists.addAll(getAllFiles(f.getAbsolutePath(), endName, null));
83 | // 每扫描一个文件夹都会调用回调,但是必须修改 MediaStoreUtil.addRar()的逻辑,
84 | // 不然每次回调都会返回已查总数(MediaStoreUtil记录的是总数且listener返回的也是总数)
85 | // getAllFiles(f.getAbsolutePath(), endName, callBack);
86 | } else {
87 | for (int i = 0; i < endName.length; i++) {
88 | if (f.getName().endsWith(endName[i])) {
89 |
90 | String fileName = f.getName();
91 | String fPath = f.getAbsolutePath();
92 | long fileLength = f.length();
93 | int fileType = MathFile(fileName);
94 | long updateTime = f.lastModified();
95 | if (fileLength > 10) {
96 | MediaEntity entity = new RarEntity(fileName, fPath, fileLength, fileType, updateTime);
97 | Log.i("ApkRunnable", "====检索的文件的====" + entity.toString());
98 | file_lists.add(entity);
99 | }
100 | }
101 | }
102 | }
103 | }
104 | }
105 | } catch (Exception e) {
106 | if (callBack != null) {
107 | callBack.onFailed(e.toString());
108 | }
109 | }
110 | if (callBack != null && !file_lists.isEmpty()) {
111 | callBack.onSuccess(file_lists);
112 | }
113 | Log.i("ApkRunnable", "====检索的文件的个数====" + file_lists.size());
114 | return file_lists;
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/runnable/AudioRunnable.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.runnable;
2 |
3 | import android.content.ContentResolver;
4 | import android.content.Context;
5 | import android.database.Cursor;
6 | import android.os.Handler;
7 | import android.os.Message;
8 | import android.provider.MediaStore;
9 | import android.util.Log;
10 |
11 | import com.zhangteng.searchfilelibrary.callback.GetListCallback;
12 | import com.zhangteng.searchfilelibrary.entity.AudioEntity;
13 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
14 | import com.zhangteng.searchfilelibrary.utils.MediaStoreUtil;
15 |
16 | import java.util.ArrayList;
17 | import java.util.List;
18 |
19 | /**
20 | * Created by swing on 2018/8/27.
21 | */
22 | public class AudioRunnable implements Runnable {
23 | private Context context;
24 | private Handler handler;
25 |
26 | public AudioRunnable(Context context) {
27 | this.context = context;
28 | }
29 |
30 | public AudioRunnable(Handler handler) {
31 | this.handler = handler;
32 | }
33 |
34 | @Override
35 | public void run() {
36 | if (handler != null) {
37 | getAllAudio(new GetListCallback() {
38 | @Override
39 | public void onSuccess(List list) {
40 | Message message = new Message();
41 | message.what = GetListCallback.SUCCESS;
42 | message.obj = list;
43 | handler.sendMessage(message);
44 | }
45 |
46 | @Override
47 | public void onFailed(String msg) {
48 | handler.sendEmptyMessage(GetListCallback.FAILED);
49 | }
50 | });
51 | return;
52 | }
53 | if (!MediaStoreUtil.getAudio().isEmpty()) {
54 | MediaStoreUtil.clearAudio();
55 | }
56 | getAllAudio(new GetListCallback() {
57 | @Override
58 | public void onSuccess(List list) {
59 | MediaStoreUtil.addAudio(list);
60 | }
61 |
62 | @Override
63 | public void onFailed(String msg) {
64 | MediaStoreUtil.clearAudio();
65 | }
66 | });
67 | }
68 |
69 | public void getAllAudio(final GetListCallback callBack) {
70 | List audios = new ArrayList<>();
71 | ContentResolver mContentResolver = context.getContentResolver();
72 | String[] projection = new String[]{MediaStore.Audio.AudioColumns._ID,
73 | MediaStore.Audio.AudioColumns.DATA,
74 | MediaStore.Audio.AudioColumns.DURATION,
75 | MediaStore.Audio.AudioColumns.SIZE,
76 | MediaStore.Audio.AudioColumns.ARTIST,
77 | MediaStore.Audio.AudioColumns.ALBUM,
78 | MediaStore.Audio.AudioColumns.DISPLAY_NAME,
79 | MediaStore.Audio.AudioColumns.DATE_MODIFIED};
80 | Cursor cursor = mContentResolver.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, null, null, MediaStore.Audio.AudioColumns.DATE_MODIFIED + " desc");
81 | while (cursor.moveToNext()) {
82 | String fileId = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns._ID));
83 | String fileName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.DISPLAY_NAME));
84 | String filePath = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.DATA));
85 | long fileSize = cursor.getLong(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.SIZE));
86 | int time = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.DURATION));
87 | String album = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.ALBUM));
88 | String artist = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.ARTIST));
89 | //方法1:歌曲文件的修改时间 (注意:精确到秒,所以还要*1000):MediaStore.Audio.Media.DATE_MODIFIED
90 | long updateTime = cursor.getLong(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.DATE_MODIFIED));
91 | updateTime = updateTime * 1000;
92 | //大于50kb的视频在显示
93 | if (fileSize / 1024 >= 50) {
94 | MediaEntity fileItem = new AudioEntity(fileName, filePath, fileSize, MediaEntity.MEDIA_AUDIO, time, artist, album, updateTime);
95 | Log.i("AudioRunnable", "===检索的音频文件===" + fileItem.toString());
96 | audios.add(fileItem);
97 | }
98 | }
99 | cursor.close();
100 | callBack.onSuccess(audios);
101 | }
102 | }
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/runnable/DocumentRunnable.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.runnable;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.os.Message;
6 | import android.util.Log;
7 |
8 | import com.zhangteng.searchfilelibrary.callback.GetListCallback;
9 | import com.zhangteng.searchfilelibrary.config.SearchCofig;
10 | import com.zhangteng.searchfilelibrary.entity.DocumentEntity;
11 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
12 | import com.zhangteng.searchfilelibrary.utils.MediaStoreUtil;
13 |
14 | import java.io.File;
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | import static com.zhangteng.searchfilelibrary.utils.MediaStoreUtil.MathFile;
19 |
20 | /**
21 | * Created by swing on 2018/8/27.
22 | */
23 | public class DocumentRunnable implements Runnable {
24 | private Context context;
25 | private Handler handler;
26 |
27 | public DocumentRunnable(Context context) {
28 | this.context = context;
29 | }
30 |
31 | public DocumentRunnable(Handler handler) {
32 | this.handler = handler;
33 | }
34 |
35 | @Override
36 | public void run() {
37 | String[] endNamed = new String[]{
38 | "txt", "pdf",
39 | "doc", "docx",
40 | "xls", "xlsx",
41 | "ppt", "pptx"
42 | };
43 | if (handler != null) {
44 | getAllFiles(SearchCofig.BASE_SD_PATH, endNamed, new GetListCallback() {
45 | @Override
46 | public void onSuccess(List list) {
47 | Message message = new Message();
48 | message.what = GetListCallback.SUCCESS;
49 | message.obj = list;
50 | handler.sendMessage(message);
51 | }
52 |
53 | @Override
54 | public void onFailed(String msg) {
55 | handler.sendEmptyMessage(GetListCallback.FAILED);
56 | }
57 | });
58 | return;
59 | }
60 | if (!MediaStoreUtil.getDocument().isEmpty()) {
61 | MediaStoreUtil.clearDocument();
62 | }
63 | getAllFiles(SearchCofig.BASE_SD_PATH, endNamed, new GetListCallback() {
64 | @Override
65 | public void onSuccess(List list) {
66 | MediaStoreUtil.addDocument(list);
67 | }
68 |
69 | @Override
70 | public void onFailed(String msg) {
71 | MediaStoreUtil.clearDocument();
72 | }
73 | });
74 | }
75 |
76 | // 遍历相应的文件
77 | public List getAllFiles(String filePath, String[] endName, GetListCallback callBack) {
78 | List file_lists = new ArrayList();
79 | try {
80 | File root = new File(filePath);
81 | File files[] = root.listFiles();
82 | if (files != null) {
83 | for (File f : files) {
84 | if (f.isDirectory()) {
85 | //扫描结束后才会调用回调
86 | file_lists.addAll(getAllFiles(f.getAbsolutePath(), endName, null));
87 | // 每扫描一个文件夹都会调用回调,但是必须修改 MediaStoreUtil.addRar()的逻辑,
88 | // 不然每次回调都会返回已查总数(MediaStoreUtil记录的是总数且listener返回的也是总数)
89 | // getAllFiles(f.getAbsolutePath(), endName, callBack);
90 | } else {
91 | for (int i = 0; i < endName.length; i++) {
92 | if (f.getName().endsWith(endName[i])) {
93 |
94 | String fileName = f.getName();
95 | String fPath = f.getAbsolutePath();
96 | long fileLength = f.length();
97 | int fileType = MathFile(fileName);
98 | long updateTime = f.lastModified();
99 | if (fileLength > 10) {
100 | MediaEntity entity = new DocumentEntity(fileName, fPath, fileLength, fileType, updateTime);
101 | Log.i("DocumentRunnable", "====检索的文件的====" + entity.toString());
102 | file_lists.add(entity);
103 | }
104 | }
105 | }
106 | }
107 | }
108 | }
109 | } catch (Exception e) {
110 | if (callBack != null) {
111 | callBack.onFailed(e.toString());
112 | }
113 | }
114 | if (callBack != null && !file_lists.isEmpty()) {
115 | callBack.onSuccess(file_lists);
116 | }
117 | Log.i("DocumentRunnable", "====检索的文件的个数====" + file_lists.size());
118 | return file_lists;
119 | }
120 |
121 | }
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/runnable/FolderRunnable.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.runnable;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.os.Message;
6 | import android.util.Log;
7 |
8 | import com.zhangteng.searchfilelibrary.callback.GetListCallback;
9 | import com.zhangteng.searchfilelibrary.config.SearchCofig;
10 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
11 | import com.zhangteng.searchfilelibrary.utils.FileErgodicUtil;
12 | import com.zhangteng.searchfilelibrary.utils.MediaStoreUtil;
13 |
14 | import java.util.List;
15 |
16 | /**
17 | * Created by swing on 2018/9/11.
18 | */
19 | public class FolderRunnable implements Runnable {
20 | private Context context;
21 | private Handler handler;
22 | private String path;
23 |
24 | public FolderRunnable(String path) {
25 | this.path = path;
26 | }
27 |
28 | public FolderRunnable(Handler handler, String path) {
29 | this.handler = handler;
30 | this.path = path;
31 | }
32 |
33 | @Override
34 | public void run() {
35 | String[] endNamed = new String[]{
36 | "txt", "pdf",
37 | "doc", "docx",
38 | "xls", "xlsx",
39 | "ppt", "pptx",
40 | "rar", "zip", "apk",
41 | "jpg", "png", "jpeg", "gif",
42 | "mp3", "wave", "wma", "mpeg",
43 | "mp4", "wmv", "m3u8", "avi", "flv", "3gp"
44 | };
45 |
46 | if (handler != null) {
47 | getAllFiles(path == null ? SearchCofig.BASE_SD_PATH : path, endNamed, new GetListCallback() {
48 | @Override
49 | public void onSuccess(List list) {
50 | Message message = new Message();
51 | message.what = GetListCallback.SUCCESS;
52 | message.obj = list;
53 | handler.sendMessage(message);
54 | }
55 |
56 | @Override
57 | public void onFailed(String msg) {
58 | handler.sendEmptyMessage(GetListCallback.FAILED);
59 | }
60 | });
61 | return;
62 | }
63 | if (!MediaStoreUtil.getFolder().isEmpty()) {
64 | MediaStoreUtil.clearFolder();
65 | }
66 | getAllFiles(path == null ? SearchCofig.BASE_SD_PATH : path, endNamed, new GetListCallback() {
67 | @Override
68 | public void onSuccess(List list) {
69 | MediaStoreUtil.addFolder(list);
70 | }
71 |
72 | @Override
73 | public void onFailed(String msg) {
74 | MediaStoreUtil.clearFolder();
75 | }
76 | });
77 | }
78 |
79 | // 遍历相应的文件
80 | public List getAllFiles(String filePath, String[] endName, GetListCallback callBack) {
81 | List file_lists = null;
82 | try {
83 | file_lists = FileErgodicUtil.getFileList(filePath, endName);
84 | } catch (Exception e) {
85 | if (callBack != null) {
86 | callBack.onFailed(e.toString());
87 | }
88 | }
89 | if (null != file_lists) {
90 | if (callBack != null && !file_lists.isEmpty()) {
91 | callBack.onSuccess(file_lists);
92 | }
93 | Log.i("ApkRunnable", "====检索的文件的个数====" + file_lists.size());
94 | }
95 | return file_lists;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/runnable/ImageRunnable.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.runnable;
2 |
3 | import android.content.ContentResolver;
4 | import android.content.Context;
5 | import android.database.Cursor;
6 | import android.graphics.Bitmap;
7 | import android.graphics.BitmapFactory;
8 | import android.os.Handler;
9 | import android.os.Message;
10 | import android.provider.MediaStore;
11 | import android.util.Log;
12 |
13 | import com.zhangteng.searchfilelibrary.callback.GetListCallback;
14 | import com.zhangteng.searchfilelibrary.entity.ImageEntity;
15 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
16 | import com.zhangteng.searchfilelibrary.utils.MediaStoreUtil;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | /**
22 | * Created by swing on 2018/8/27.
23 | */
24 | public class ImageRunnable implements Runnable {
25 | private Context context;
26 | private Handler handler;
27 |
28 | public ImageRunnable(Context context) {
29 | this.context = context;
30 | }
31 |
32 | public ImageRunnable(Handler handler) {
33 | this.handler = handler;
34 | }
35 |
36 | /**
37 | * 根据图片的ID得到缩略图
38 | *
39 | * @param cr
40 | * @param imageId
41 | * @return
42 | */
43 | public static Bitmap getThumbnailsFromImageId(ContentResolver cr, String imageId) {
44 | if (imageId == null || imageId.equals(""))
45 | return null;
46 |
47 | Bitmap bitmap = null;
48 | BitmapFactory.Options options = new BitmapFactory.Options();
49 | options.inDither = false;
50 | options.inPreferredConfig = Bitmap.Config.ARGB_8888;
51 |
52 | long imageIdLong = Long.parseLong(imageId);
53 | //via imageid get the bimap type thumbnail in thumbnail table.
54 | bitmap = MediaStore.Images.Thumbnails.getThumbnail(cr, imageIdLong, MediaStore.Images.Thumbnails.MINI_KIND, options);
55 |
56 | return bitmap;
57 | }
58 |
59 | @Override
60 | public void run() {
61 | if (handler != null) {
62 | getImageNames(new GetListCallback() {
63 | @Override
64 | public void onSuccess(List list) {
65 | Message message = new Message();
66 | message.what = GetListCallback.SUCCESS;
67 | message.obj = list;
68 | handler.sendMessage(message);
69 | }
70 |
71 | @Override
72 | public void onFailed(String msg) {
73 | handler.sendEmptyMessage(GetListCallback.FAILED);
74 | }
75 | });
76 | return;
77 | }
78 | if (!MediaStoreUtil.getImage().isEmpty()) {
79 | MediaStoreUtil.clearImage();
80 | }
81 | getImageNames(new GetListCallback() {
82 | @Override
83 | public void onSuccess(List list) {
84 | MediaStoreUtil.addImage(list);
85 | }
86 |
87 | @Override
88 | public void onFailed(String msg) {
89 | MediaStoreUtil.clearImage();
90 | }
91 | });
92 | }
93 |
94 | /**
95 | * 查询图片文件名称
96 | *
97 | * @return
98 | */
99 | public void getImageNames(final GetListCallback callBack) {
100 | List list = new ArrayList();
101 | Cursor cursor = context.getContentResolver().query(
102 | MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
103 | new String[]{MediaStore.Images.Media._ID, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.TITLE,
104 | MediaStore.Images.Media.MIME_TYPE, MediaStore.Images.Media.SIZE, MediaStore.Images.Media.DATA}, null,
105 | new String[]{}, null);
106 | while (cursor.moveToNext()) {
107 | Log.i("ImageRunnable", "filePath==" + MediaStore.Images.Media.DATA);
108 | String filePath = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
109 | String fileName = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME));
110 | long fileSize = cursor.getLong(cursor.getColumnIndex(MediaStore.Images.Media.SIZE));
111 | MediaEntity entity = new ImageEntity(fileName, filePath, fileSize, MediaEntity.MEDIA_IMAGE);
112 | Log.i("ImageRunnable", "==查询的图片==" + entity.toString());
113 | list.add(entity);
114 | }
115 | callBack.onSuccess(list);
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/runnable/RarRunnable.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.runnable;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.os.Message;
6 | import android.util.Log;
7 |
8 | import com.zhangteng.searchfilelibrary.callback.GetListCallback;
9 | import com.zhangteng.searchfilelibrary.config.SearchCofig;
10 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
11 | import com.zhangteng.searchfilelibrary.entity.RarEntity;
12 | import com.zhangteng.searchfilelibrary.utils.MediaStoreUtil;
13 |
14 | import java.io.File;
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | import static com.zhangteng.searchfilelibrary.utils.MediaStoreUtil.MathFile;
19 |
20 | /**
21 | * Created by swing on 2018/8/27.
22 | */
23 | public class RarRunnable implements Runnable {
24 | private Context context;
25 | private Handler handler;
26 |
27 | public RarRunnable(Context context) {
28 | this.context = context;
29 | }
30 |
31 | public RarRunnable(Handler handler) {
32 | this.handler = handler;
33 | }
34 |
35 | @Override
36 | public void run() {
37 | String[] zipName = new String[]{"zip", "rar"};
38 | if (handler != null) {
39 | getAllFiles(SearchCofig.BASE_SD_PATH, zipName, new GetListCallback() {
40 | @Override
41 | public void onSuccess(List list) {
42 | Message message = new Message();
43 | message.what = GetListCallback.SUCCESS;
44 | message.obj = list;
45 | handler.sendMessage(message);
46 | }
47 |
48 | @Override
49 | public void onFailed(String msg) {
50 | handler.sendEmptyMessage(GetListCallback.FAILED);
51 | }
52 | });
53 | return;
54 | }
55 | if (!MediaStoreUtil.getRar().isEmpty()) {
56 | MediaStoreUtil.clearRar();
57 | }
58 | getAllFiles(SearchCofig.BASE_SD_PATH, zipName, new GetListCallback() {
59 | @Override
60 | public void onSuccess(List list) {
61 | MediaStoreUtil.addRar(list);
62 | }
63 |
64 | @Override
65 | public void onFailed(String msg) {
66 | MediaStoreUtil.clearRar();
67 | }
68 | });
69 | }
70 |
71 | // 遍历相应的文件
72 | public List getAllFiles(String filePath, String[] endName, GetListCallback callBack) {
73 | List file_lists = new ArrayList();
74 | try {
75 | File root = new File(filePath);
76 | File files[] = root.listFiles();
77 | if (files != null) {
78 | for (File f : files) {
79 | if (f.isDirectory()) {
80 | //扫描结束后才会调用回调
81 | file_lists.addAll(getAllFiles(f.getAbsolutePath(), endName, null));
82 | // 每扫描一个文件夹都会调用回调,但是必须修改 MediaStoreUtil.addRar()的逻辑,
83 | // 不然每次回调都会返回已查总数(MediaStoreUtil记录的是总数且listener返回的也是总数)
84 | // getAllFiles(f.getAbsolutePath(), endName, callBack);
85 | } else {
86 | for (int i = 0; i < endName.length; i++) {
87 | if (f.getName().endsWith(endName[i])) {
88 |
89 | String fileName = f.getName();
90 | String fPath = f.getAbsolutePath();
91 | long fileLength = f.length();
92 | int fileType = MathFile(fileName);
93 | long updateTime = f.lastModified();
94 | if (fileLength > 10) {
95 | MediaEntity entity = new RarEntity(fileName, fPath, fileLength, fileType, updateTime);
96 | Log.i("RarRunnable", "====检索的文件的====" + entity.toString());
97 | file_lists.add(entity);
98 | }
99 | }
100 | }
101 | }
102 | }
103 | }
104 | } catch (Exception e) {
105 | if (callBack != null) {
106 | callBack.onFailed(e.toString());
107 | }
108 | }
109 | if (callBack != null && !file_lists.isEmpty()) {
110 | callBack.onSuccess(file_lists);
111 | }
112 | Log.i("RarRunnable", "====检索的文件的个数====" + file_lists.size());
113 | return file_lists;
114 | }
115 |
116 | }
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/java/com/zhangteng/searchfilelibrary/utils/FileErgodicUtil.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary.utils;
2 |
3 | import android.util.Log;
4 |
5 | import com.zhangteng.searchfilelibrary.entity.AudioEntity;
6 | import com.zhangteng.searchfilelibrary.entity.DocumentEntity;
7 | import com.zhangteng.searchfilelibrary.entity.FolderEntity;
8 | import com.zhangteng.searchfilelibrary.entity.ImageEntity;
9 | import com.zhangteng.searchfilelibrary.entity.MediaEntity;
10 | import com.zhangteng.searchfilelibrary.entity.RarEntity;
11 | import com.zhangteng.searchfilelibrary.entity.VideoEntity;
12 |
13 | import java.io.File;
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | import static com.zhangteng.searchfilelibrary.utils.MediaStoreUtil.MathFileByType;
18 |
19 | /**
20 | * Created by swing on 2018/8/27.
21 | */
22 | public class FileErgodicUtil {
23 |
24 | public static List getFileList(String directoryPath, String[] endNamed) {
25 |
26 | List list = new ArrayList<>();
27 | File directory = new File(directoryPath);
28 | FolderEntity parent = null;
29 | if (directory.isDirectory()) {
30 | parent = new FolderEntity(directory.getName(), directory.getAbsolutePath(), MediaEntity.MEDIA_FOLDER, directory.lastModified());
31 | } else {
32 | throw new NullPointerException("未找到路径对应的文件夹");
33 | }
34 | for (File file : directory.listFiles()) {
35 | if (file.isDirectory()) {
36 | FolderEntity child = new FolderEntity(file.getName(), file.getAbsolutePath(), MediaEntity.MEDIA_FOLDER, file.lastModified());
37 | child.setParent(parent);
38 | // child.setChildren(getFileList(child.getFilePath(), endNamed));
39 | list.add(child);
40 | } else {
41 | String path = file.getAbsolutePath();
42 | for (String type : endNamed) {
43 | if (path.endsWith(type)) {
44 | String fileName = file.getName();
45 | long fileLength = file.length();
46 | int fileType = MathFileByType(type);
47 | long updateTime = file.lastModified();
48 | if (fileLength > 10) {
49 | MediaEntity entity = null;
50 | switch (fileType) {
51 | case MediaEntity.MEDIA_APK:
52 | case MediaEntity.MEDIA_ZIP:
53 | entity = new RarEntity(fileName, path, fileLength, fileType, updateTime);
54 | break;
55 | case MediaEntity.MEDIA_PDF:
56 | case MediaEntity.MEDIA_DOC:
57 | case MediaEntity.MEDIA_PPT:
58 | case MediaEntity.MEDIA_EXCEL:
59 | case MediaEntity.MEDIA_TXT:
60 | case MediaEntity.MEDIA_DOCUMENT:
61 | entity = new DocumentEntity(fileName, path, fileLength, fileType, updateTime);
62 | break;
63 | case MediaEntity.MEDIA_AUDIO:
64 | entity = new AudioEntity(fileName, path, fileLength, fileType, updateTime);
65 | break;
66 | case MediaEntity.MEDIA_IMAGE:
67 | entity = new ImageEntity(fileName, path, fileLength, fileType, updateTime);
68 | break;
69 | case MediaEntity.MEDIA_VIDEO:
70 | entity = new VideoEntity(fileName, path, fileLength, fileType, updateTime);
71 | break;
72 | case MediaEntity.MEDIA_FOLDER:
73 | case MediaEntity.MEDIA_UNKNOWN:
74 | break;
75 | default:
76 | break;
77 | }
78 |
79 | Log.i("MediaStoreUtil", "====检索的文件的====" + entity.toString());
80 | list.add(entity);
81 | }
82 | break;
83 | }
84 | }
85 | }
86 | }
87 | return list;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SearchFileLibrary
3 |
4 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/main/res/xml/file_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
12 |
13 |
16 |
17 |
20 |
21 |
24 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/filepicker-searchfilelibrary/src/test/java/com/zhangteng/searchfilelibrary/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.searchfilelibrary;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/filepicker-videopicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/filepicker-videopicker/build.gradle:
--------------------------------------------------------------------------------
1 | if (isRunAlone.toBoolean()) {
2 | apply plugin: 'com.android.application'
3 | } else {
4 | apply plugin: 'com.android.library'
5 | }
6 |
7 | android {
8 | compileSdkVersion 32
9 |
10 |
11 | defaultConfig {
12 | if (isRunAlone.toBoolean()) {
13 | applicationId "com.zhangteng.videopicker"
14 | }
15 | minSdkVersion 21
16 | //noinspection ExpiredTargetSdkVersion
17 | targetSdkVersion 32
18 | versionCode 1
19 | versionName "1.0"
20 |
21 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
22 |
23 | }
24 |
25 | buildTypes {
26 | release {
27 | minifyEnabled false
28 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 | sourceSets {
32 | main {
33 | if (isRunAlone.toBoolean()) {
34 | manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
35 | } else {
36 | manifest.srcFile 'src/main/AndroidManifest.xml'
37 | }
38 | }
39 | }
40 | compileOptions {
41 | sourceCompatibility JavaVersion.VERSION_1_8
42 | targetCompatibility JavaVersion.VERSION_1_8
43 | }
44 | }
45 |
46 | dependencies {
47 | implementation fileTree(include: ['*.jar'], dir: 'libs')
48 | implementation 'androidx.appcompat:appcompat:1.4.1'
49 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
50 | implementation 'com.google.android.material:material:1.4.0'
51 | testImplementation 'junit:junit:4.13.2'
52 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
53 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
54 |
55 | implementation project(':filepicker-searchfilelibrary')
56 | implementation project(':filepicker-common')
57 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.2.0'
58 | implementation 'com.github.DL-ZhangTeng:Utils:2.0.1'
59 | }
--------------------------------------------------------------------------------
/filepicker-videopicker/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/androidTest/java/com/zhangteng/videopicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.videopicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zhangteng.videopicker.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/java/com/zhangteng/videopicker/VideoPickerActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.videopicker;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 | public class VideoPickerActivity extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_video_picker);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/manifest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/layout/activity_video_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/layout/fragment_video_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
20 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/layout/item_video_picker_camera.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/layout/item_video_picker_photo.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
23 |
24 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xhdpi/picker_select_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xhdpi/picker_select_checked.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xhdpi/picker_select_unchecked.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xhdpi/video_picker_camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xhdpi/video_picker_camera.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/filepicker-videopicker/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 | #88000000
9 |
10 | #FF343535
11 |
12 |
13 | #f7eee3
14 |
15 | #FFDCDCDC
16 |
17 | #FF999999
18 |
19 | #FF333333
20 |
21 |
22 | #FFFFFFFF
23 | #00E9C4
24 |
25 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | VideoPicker
3 |
4 | %d 个视频已选择
5 | 拍摄视频
6 |
7 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/filepicker-videopicker/src/test/java/com/zhangteng/videopicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhangteng.videopicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | android.useAndroidX=true
15 | android.enableJetifier=true
16 | # Kotlin code style for this project: "official" or "obsolete":
17 | kotlin.code.style=official
18 | android.injected.testOnly=false
19 | isRunAlone=false
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Nov 13 21:57:54 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/screenshot/20200807160902112.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/screenshot/20200807160902112.jpg
--------------------------------------------------------------------------------
/screenshot/20200807160902219.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/screenshot/20200807160902219.jpg
--------------------------------------------------------------------------------
/screenshot/20200914093052474.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/screenshot/20200914093052474.png
--------------------------------------------------------------------------------
/screenshot/20200914093222160.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/screenshot/20200914093222160.png
--------------------------------------------------------------------------------
/screenshot/20200914093256824.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DL-ZhangTeng/FilePicker/53c5c80de9f98840efd8f90f6f7a6eb389c5cf12/screenshot/20200914093256824.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':filepicker-searchfilelibrary', ':filepicker-videopicker', ':filepicker-audiopicker', ':filepicker-imagepicker', ':filepicker-documentpicker', ':filepicker-rarpicker', ':filepicker-folderpicker', ':filepicker-common'
2 |
--------------------------------------------------------------------------------