GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — #288 added span count · CodeHunterDev/Android-FilePicker@1c74fb7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
  • app
    • build.gradle
    • src/main/java/vi/filepicker
      • MainActivity.java
  • build.gradle
  • filepicker
    • build.gradle
    • src/main
      • java/droidninja/filepicker
        • FilePickerActivity.kt
        • FilePickerBuilder.kt
        • FilePickerConst.kt
        • MediaDetailsActivity.kt
        • PickerManager.kt
        • fragments
          • MediaDetailPickerFragment.kt
          • MediaFolderPickerFragment.kt
      • res/layout
        • fragment_media_folder_picker.xml
  • gradle/wrapper
    • gradle-wrapper.properties
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

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 numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ showFolderView(boolean status) | if you want to show folder type pick view, e
113113
enableDocSupport(boolean status) | If you want to enable/disable default document picker, use this method. (*Enabled by default*)
114114
enableCameraSupport(boolean status) | to show camera in the picker (*Enabled by default*)
115115
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]])
116117

117118
If you want to add custom file type picker(do not use . in extension types), use *addFileSupport()* method like this ( for zip support):
118119

Collapse file

‎app/build.gradle‎

Copy file name to clipboardExpand all lines: app/build.gradle
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
6-
compileSdkVersion 29
7-
buildToolsVersion '29.0.3'
6+
compileSdkVersion 30
7+
buildToolsVersion '30.0.2'
88

99
defaultConfig {
1010
applicationId "vi.filepicker"
1111
minSdkVersion 17
12-
targetSdkVersion 29
12+
targetSdkVersion 30
1313
versionCode 1
1414
versionName "1.0"
1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -26,21 +26,21 @@ dependencies {
2626
implementation fileTree(include: ['*.jar'], dir: 'libs')
2727
testImplementation 'junit:junit:4.12'
2828
implementation project(':filepicker')
29-
implementation 'androidx.appcompat:appcompat:1.1.0'
29+
implementation 'androidx.appcompat:appcompat:1.2.0'
3030
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'
3232
implementation "com.github.xinyuez:easypermissions:2.0.1"
3333
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
3434
// Required for instrumented tests
3535
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'
3838
// Optional -- UI testing with Espresso
3939
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-beta02', {
4040
exclude group: 'com.android.support', module: 'support-annotations'
4141
})
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'
4444

4545
// compile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
4646
}
Collapse file

‎app/src/main/java/vi/filepicker/MainActivity.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/vi/filepicker/MainActivity.java
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ public void onPickPhoto() {
151151
.setSelectedFiles(photoPaths) //this is optional
152152
.setActivityTheme(R.style.FilePickerTheme)
153153
.setActivityTitle("Please select media")
154+
.setSpan(FilePickerConst.SPAN_TYPE.FOLDER_SPAN, 3)
155+
.setSpan(FilePickerConst.SPAN_TYPE.DETAIL_SPAN, 4)
154156
.enableVideoPicker(true)
155157
.enableCameraSupport(true)
156158
.showGifs(true)
Collapse file

‎build.gradle‎

Copy file name to clipboardExpand all lines: build.gradle
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.72'
4+
ext.kotlin_version = '1.4.10'
55
repositories {
66
google()
77
jcenter()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.6.3'
10+
classpath 'com.android.tools.build:gradle:4.1.0'
1111
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
1212
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Collapse file

‎filepicker/build.gradle‎

Copy file name to clipboardExpand all lines: filepicker/build.gradle
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ apply plugin: "com.jfrog.bintray"
77
version = "2.2.4"
88

99
android {
10-
compileSdkVersion 29
11-
buildToolsVersion '29.0.3'
10+
compileSdkVersion 30
11+
buildToolsVersion '30.0.2'
1212

1313
defaultConfig {
1414
minSdkVersion 17
15-
targetSdkVersion 29
15+
targetSdkVersion 30
1616
versionCode 1
1717
versionName version
1818
}
@@ -26,11 +26,11 @@ android {
2626

2727
dependencies {
2828
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'
3131
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'
3434
api 'com.github.bumptech.glide:glide:4.11.0'
3535
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
3636
testImplementation 'junit:junit:4.12'
Collapse file

‎filepicker/src/main/java/droidninja/filepicker/FilePickerActivity.kt‎

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 numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.app.Activity
55
import android.content.Intent
66
import android.net.Uri
77
import android.os.Bundle
8-
import androidx.appcompat.app.ActionBar
98
import android.text.TextUtils
109
import android.view.Menu
1110
import android.view.MenuItem
@@ -14,7 +13,7 @@ import droidninja.filepicker.fragments.DocPickerFragment
1413
import droidninja.filepicker.fragments.MediaPickerFragment
1514
import droidninja.filepicker.fragments.PhotoPickerFragmentListener
1615
import droidninja.filepicker.utils.FragmentUtil
17-
import java.util.ArrayList
16+
import java.util.*
1817

1918
class FilePickerActivity : BaseFilePickerActivity(), PhotoPickerFragmentListener, DocFragment.DocFragmentListener, DocPickerFragment.DocPickerFragmentListener, MediaPickerFragment.MediaPickerFragmentListener {
2019
private var type: Int = 0
Collapse file

‎filepicker/src/main/java/droidninja/filepicker/FilePickerBuilder.kt‎

Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/FilePickerBuilder.kt
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ class FilePickerBuilder {
3737
return this
3838
}
3939

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+
4050
fun setSelectedFiles(selectedPhotos: ArrayList<Uri>): FilePickerBuilder {
4151
mPickerOptionsBundle.putParcelableArrayList(FilePickerConst.KEY_SELECTED_MEDIA, selectedPhotos)
4252
return this
Collapse file

‎filepicker/src/main/java/droidninja/filepicker/FilePickerConst.kt‎

Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/FilePickerConst.kt
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,8 @@ object FilePickerConst {
4747
enum class FILE_TYPE {
4848
PDF, WORD, EXCEL, PPT, TXT, UNKNOWN
4949
}
50+
51+
enum class SPAN_TYPE{
52+
FOLDER_SPAN, DETAIL_SPAN
53+
}
5054
}
Collapse file

‎filepicker/src/main/java/droidninja/filepicker/MediaDetailsActivity.kt‎

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 numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class MediaDetailsActivity : BaseFilePickerActivity(), FileAdapterListener {
7373
recyclerView = findViewById(R.id.recyclerview)
7474
emptyView = findViewById(R.id.empty_view)
7575

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)
7778
layoutManager.gapStrategy = StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
7879
recyclerView?.layoutManager = layoutManager
7980
recyclerView?.itemAnimator = DefaultItemAnimator()
Collapse file

‎filepicker/src/main/java/droidninja/filepicker/PickerManager.kt‎

Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/PickerManager.kt
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ object PickerManager {
3838

3939
var isEnableCamera = true
4040

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+
4151
/**
4252
* The preferred screen orientation this activity would like to run in.
4353
* From the {@link android.R.attr#screenOrientation} attribute, one of

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.