GeezerVison is showing github.com — #288 added span count · CodeHunterDev/Android-FilePicker@1c74fb7
File treeExpand file treeCollapse file tree Open diff view settings src/main/java/vi/filepicker
java/droidninja/filepicker
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: README.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -113,6 +113,7 @@ showFolderView(boolean status) | if you want to show folder type pick view, e | 113 | 113 | enableDocSupport(boolean status) | If you want to enable/disable default document picker, use this method. (*Enabled by default*) | 114 | 114 | enableCameraSupport(boolean status) | to show camera in the picker (*Enabled by default*) | 115 | 115 | addFileSupport(String title, String[] extensions, @DrawableRes int drawable) | If you want to specify custom file type, use this method. (*example below*) | | 116 | +setSpan(spanType: FilePickerConst.SPAN_TYPE, count: Int) | Set Span count for folder and detail screen ( [FilePickerConst.SPAN_TYPE.FOLDER_SPAN] or [FilePickerConst.SPAN_TYPE.DETAIL_SPAN]]) | 116 | 117 |
| 117 | 118 | If you want to add custom file type picker(do not use . in extension types), use *addFileSupport()* method like this ( for zip support): | 118 | 119 |
| |
Collapse file Copy file name to clipboardExpand all lines: app/build.gradle +9-9Lines changed: 9 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,13 +3,13 @@ apply plugin: 'kotlin-android' | 3 | 3 | apply plugin: 'kotlin-android-extensions' | 4 | 4 |
| 5 | 5 | android { | 6 | | - compileSdkVersion 29 | 7 | | - buildToolsVersion '29.0.3' | | 6 | + compileSdkVersion 30 | | 7 | + buildToolsVersion '30.0.2' | 8 | 8 |
| 9 | 9 | defaultConfig { | 10 | 10 | applicationId "vi.filepicker" | 11 | 11 | minSdkVersion 17 | 12 | | - targetSdkVersion 29 | | 12 | + targetSdkVersion 30 | 13 | 13 | versionCode 1 | 14 | 14 | versionName "1.0" | 15 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | @@ -26,21 +26,21 @@ dependencies { | 26 | 26 | implementation fileTree(include: ['*.jar'], dir: 'libs') | 27 | 27 | testImplementation 'junit:junit:4.12' | 28 | 28 | implementation project(':filepicker') | 29 | | - implementation 'androidx.appcompat:appcompat:1.1.0' | | 29 | + implementation 'androidx.appcompat:appcompat:1.2.0' | 30 | 30 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' | 31 | | - implementation 'androidx.recyclerview:recyclerview:1.0.0' | | 31 | + implementation 'androidx.recyclerview:recyclerview:1.1.0' | 32 | 32 | implementation "com.github.xinyuez:easypermissions:2.0.1" | 33 | 33 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | 34 | 34 | // Required for instrumented tests | 35 | 35 | androidTestImplementation 'androidx.annotation:annotation:1.1.0' | 36 | | - androidTestImplementation 'androidx.test:runner:1.3.0-alpha02' | 37 | | - androidTestImplementation 'androidx.test:rules:1.3.0-alpha02' | | 36 | + androidTestImplementation 'androidx.test:runner:1.3.0' | | 37 | + androidTestImplementation 'androidx.test:rules:1.3.0' | 38 | 38 | // Optional -- UI testing with Espresso | 39 | 39 | androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-beta02', { | 40 | 40 | exclude group: 'com.android.support', module: 'support-annotations' | 41 | 41 | }) | 42 | | - androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0-beta02' | 43 | | - androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.0-beta02' | | 42 | + androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0' | | 43 | + androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0' | 44 | 44 |
| 45 | 45 | // compile 'com.squareup.leakcanary:leakcanary-android:1.5.1' | 46 | 46 | } |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/vi/filepicker/MainActivity.java +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -151,6 +151,8 @@ public void onPickPhoto() { | 151 | 151 | .setSelectedFiles(photoPaths) //this is optional | 152 | 152 | .setActivityTheme(R.style.FilePickerTheme) | 153 | 153 | .setActivityTitle("Please select media") | | 154 | + .setSpan(FilePickerConst.SPAN_TYPE.FOLDER_SPAN, 3) | | 155 | + .setSpan(FilePickerConst.SPAN_TYPE.DETAIL_SPAN, 4) | 154 | 156 | .enableVideoPicker(true) | 155 | 157 | .enableCameraSupport(true) | 156 | 158 | .showGifs(true) | |
Collapse file Copy file name to clipboardExpand all lines: build.gradle +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. | 2 | 2 |
| 3 | 3 | buildscript { | 4 | | - ext.kotlin_version = '1.3.72' | | 4 | + ext.kotlin_version = '1.4.10' | 5 | 5 | repositories { | 6 | 6 | google() | 7 | 7 | jcenter() | 8 | 8 | } | 9 | 9 | dependencies { | 10 | | - classpath 'com.android.tools.build:gradle:3.6.3' | | 10 | + classpath 'com.android.tools.build:gradle:4.1.0' | 11 | 11 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' | 12 | 12 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' | 13 | 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |
Collapse file Copy file name to clipboardExpand all lines: filepicker/build.gradle +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,12 +7,12 @@ apply plugin: "com.jfrog.bintray" | 7 | 7 | version = "2.2.4" | 8 | 8 |
| 9 | 9 | android { | 10 | | - compileSdkVersion 29 | 11 | | - buildToolsVersion '29.0.3' | | 10 | + compileSdkVersion 30 | | 11 | + buildToolsVersion '30.0.2' | 12 | 12 |
| 13 | 13 | defaultConfig { | 14 | 14 | minSdkVersion 17 | 15 | | - targetSdkVersion 29 | | 15 | + targetSdkVersion 30 | 16 | 16 | versionCode 1 | 17 | 17 | versionName version | 18 | 18 | } | @@ -26,11 +26,11 @@ android { | 26 | 26 |
| 27 | 27 | dependencies { | 28 | 28 | implementation fileTree(dir: 'libs', include: ['*.jar']) | 29 | | - implementation 'androidx.appcompat:appcompat:1.1.0' | 30 | | - implementation 'com.google.android.material:material:1.1.0' | | 29 | + implementation 'androidx.appcompat:appcompat:1.2.0' | | 30 | + implementation 'com.google.android.material:material:1.2.1' | 31 | 31 | implementation 'androidx.recyclerview:recyclerview:1.1.0' | 32 | | - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5' | 33 | | - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5' | | 32 | + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9' | | 33 | + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9' | 34 | 34 | api 'com.github.bumptech.glide:glide:4.11.0' | 35 | 35 | annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' | 36 | 36 | testImplementation 'junit:junit:4.12' | |
Collapse file Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/FilePickerActivity.kt +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,6 @@ import android.app.Activity | 5 | 5 | import android.content.Intent | 6 | 6 | import android.net.Uri | 7 | 7 | import android.os.Bundle | 8 | | -import androidx.appcompat.app.ActionBar | 9 | 8 | import android.text.TextUtils | 10 | 9 | import android.view.Menu | 11 | 10 | import android.view.MenuItem | @@ -14,7 +13,7 @@ import droidninja.filepicker.fragments.DocPickerFragment | 14 | 13 | import droidninja.filepicker.fragments.MediaPickerFragment | 15 | 14 | import droidninja.filepicker.fragments.PhotoPickerFragmentListener | 16 | 15 | import droidninja.filepicker.utils.FragmentUtil | 17 | | -import java.util.ArrayList | | 16 | +import java.util.* | 18 | 17 |
| 19 | 18 | class FilePickerActivity : BaseFilePickerActivity(), PhotoPickerFragmentListener, DocFragment.DocFragmentListener, DocPickerFragment.DocPickerFragmentListener, MediaPickerFragment.MediaPickerFragmentListener { | 20 | 19 | private var type: Int = 0 | |
Collapse file Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/FilePickerBuilder.kt +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,6 +37,16 @@ class FilePickerBuilder { | 37 | 37 | return this | 38 | 38 | } | 39 | 39 |
| | 40 | + /** | | 41 | + * @param spanType it could be [FilePickerConst.SPAN_TYPE.FOLDER_SPAN] (for folder screen) | | 42 | + * or [FilePickerConst.SPAN_TYPE.DETAIL_SPAN] (for details screen) | | 43 | + * @param count span count in integer, defaults for Folder is 2 and Details is 3 | | 44 | + */ | | 45 | + fun setSpan(spanType: FilePickerConst.SPAN_TYPE, count: Int): FilePickerBuilder { | | 46 | + PickerManager.spanTypes[spanType] = count | | 47 | + return this | | 48 | + } | | 49 | + | 40 | 50 | fun setSelectedFiles(selectedPhotos: ArrayList<Uri>): FilePickerBuilder { | 41 | 51 | mPickerOptionsBundle.putParcelableArrayList(FilePickerConst.KEY_SELECTED_MEDIA, selectedPhotos) | 42 | 52 | return this | |
Collapse file Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/FilePickerConst.kt +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -47,4 +47,8 @@ object FilePickerConst { | 47 | 47 | enum class FILE_TYPE { | 48 | 48 | PDF, WORD, EXCEL, PPT, TXT, UNKNOWN | 49 | 49 | } | | 50 | + | | 51 | + enum class SPAN_TYPE{ | | 52 | + FOLDER_SPAN, DETAIL_SPAN | | 53 | + } | 50 | 54 | } |
Collapse file Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/MediaDetailsActivity.kt +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -73,7 +73,8 @@ class MediaDetailsActivity : BaseFilePickerActivity(), FileAdapterListener { | 73 | 73 | recyclerView = findViewById(R.id.recyclerview) | 74 | 74 | emptyView = findViewById(R.id.empty_view) | 75 | 75 |
| 76 | | - val layoutManager = StaggeredGridLayoutManager(3, OrientationHelper.VERTICAL) | | 76 | + val spanCount = PickerManager.spanTypes[FilePickerConst.SPAN_TYPE.DETAIL_SPAN] ?: 3 | | 77 | + val layoutManager = StaggeredGridLayoutManager(spanCount, OrientationHelper.VERTICAL) | 77 | 78 | layoutManager.gapStrategy = StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS | 78 | 79 | recyclerView?.layoutManager = layoutManager | 79 | 80 | recyclerView?.itemAnimator = DefaultItemAnimator() | |
Collapse file Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/PickerManager.kt +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,6 +38,16 @@ object PickerManager { | 38 | 38 |
| 39 | 39 | var isEnableCamera = true | 40 | 40 |
| | 41 | + /** | | 42 | + * Recyclerview span count for both folder and detail screen | | 43 | + * Default Folder span is 2 | | 44 | + * Default Detail Span is 3 | | 45 | + */ | | 46 | + var spanTypes = mutableMapOf( | | 47 | + FilePickerConst.SPAN_TYPE.FOLDER_SPAN to 2, | | 48 | + FilePickerConst.SPAN_TYPE.DETAIL_SPAN to 3 | | 49 | + ) | | 50 | + | 41 | 51 | /** | 42 | 52 | * The preferred screen orientation this activity would like to run in. | 43 | 53 | * From the {@link android.R.attr#screenOrientation} attribute, one of | |
|