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 — Merge branch 'develop' into adding_feature_file_size · CodeHunterDev/Android-FilePicker@f413e54

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
      • res/values
        • colors.xml
        • styles.xml
  • build.gradle
  • filepicker
    • build.gradle
    • src/main
      • java/droidninja/filepicker
        • BaseFilePickerActivity.kt
        • FilePickerActivity.kt
        • FilePickerBuilder.kt
        • FilePickerConst.kt
        • MediaDetailsActivity.kt
        • PickerManager.kt
        • fragments
          • MediaDetailPickerFragment.kt
          • MediaFolderPickerFragment.kt
      • res
        • color
          • selector_tab_text_color.xml
          • selector_tab_text_color_dark.xml
        • layout
          • activity_file_picker.xml
          • activity_media_details.xml
          • fragment_media_folder_picker.xml
          • fragment_media_picker.xml
        • values
          • styles.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
+37-12Lines changed: 37 additions & 12 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ showFolderView(boolean status) | if you want to show folder type pick view, e
114114
enableDocSupport(boolean status) | If you want to enable/disable default document picker, use this method. (*Enabled by default*)
115115
enableCameraSupport(boolean status) | to show camera in the picker (*Enabled by default*)
116116
addFileSupport(String title, String[] extensions, @DrawableRes int drawable) | If you want to specify custom file type, use this method. (*example below*)
117+
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]])
117118

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

@@ -123,29 +124,53 @@ String zipTypes = {"zip","rar"};
123124
```
124125

125126
#Styling
126-
Just override these styles in your main module to change colors and themes
127+
Just override these styles in your main module to change colors and themes.
128+
129+
- If you have dark theme colors, just use `LibAppTheme.Dark`
130+
- If you have light theme colors, just use `LibAppTheme`
131+
127132
```xml
128-
<style name="LibAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
133+
<style name="LibAppTheme" parent="Theme.MaterialComponents.NoActionBar">
129134
<!-- Customize your theme here. -->
130135
<item name="colorPrimary">@color/colorPrimary</item>
131136
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
132-
<item name="colorAccent">@color/colorAccent</item>
137+
<item name="colorAccent">@android:color/black</item>
133138
<item name="android:colorBackground">@android:color/background_light</item>
134139
<item name="android:windowBackground">@android:color/white</item>
140+
<item name="toolbarStyle">@style/ToolbarTheme</item>
141+
<item name="tabStyle">@style/PickerTabLayout</item>
135142
</style>
136143

137-
<style name="PickerTabLayout" parent="Widget.Design.TabLayout">
138-
<item name="tabBackground">@color/colorPrimary</item>
139-
<item name="tabGravity">fill</item>
140-
<item name="tabMaxWidth">0dp</item>
144+
<style name="LibAppTheme.Dark" parent="LibAppTheme">
145+
<!-- Customize your theme here. -->
146+
<item name="colorAccent">@android:color/white</item>
147+
<item name="toolbarStyle">@style/ToolbarTheme.Dark</item>
148+
<item name="tabStyle">@style/PickerTabLayout.Dark</item>
141149
</style>
150+
151+
<style name="PickerTabLayout" parent="Widget.MaterialComponents.TabLayout">
152+
<!-- tab background-->
153+
<item name="tabBackground">@color/colorPrimary</item>
154+
<!-- tab text color selector : set selector accordingly to dark or light theme-->
155+
<item name="tabTextColor">@color/selector_tab_text_color</item>
156+
<!-- tab indicator color: set indicator color accordingly-->
157+
<item name="tabIndicatorColor">@android:color/black</item>
158+
<item name="tabGravity">fill</item>
159+
<item name="tabMaxWidth">0dp</item>
160+
</style>
161+
162+
163+
<style name="ToolbarTheme" parent="Widget.MaterialComponents.Toolbar.Primary">
164+
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Toolbar.Light</item>
165+
<item name="android:theme">@style/ThemeOverlay.App.Toolbar.Light</item>
166+
</style>
142167

143168
<style name="SmoothCheckBoxStyle">
144-
<item name="color_checked">@color/checkbox_color</item>
145-
<item name="color_unchecked">@android:color/white</item>
146-
<item name="color_unchecked_stroke">@color/checkbox_unchecked_color</item>
147-
<item name="color_tick">@android:color/white</item>
148-
</style>
169+
<item name="color_checked">@color/colorAccent</item>
170+
<item name="color_unchecked">@android:color/white</item>
171+
<item name="color_unchecked_stroke">@color/checkbox_unchecked_color</item>
172+
<item name="color_tick">@android:color/white</item>
173+
</style>
149174
```
150175

151176
# Proguard
Collapse file

‎app/build.gradle‎

Copy file name to clipboardExpand all lines: app/build.gradle
+10-9Lines changed: 10 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,22 @@ 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"
33+
implementation 'com.google.android.material:material:1.2.1'
3334
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
3435
// Required for instrumented tests
3536
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'
37+
androidTestImplementation 'androidx.test:runner:1.3.0'
38+
androidTestImplementation 'androidx.test:rules:1.3.0'
3839
// Optional -- UI testing with Espresso
3940
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-beta02', {
4041
exclude group: 'com.android.support', module: 'support-annotations'
4142
})
42-
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0-beta02'
43-
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.0-beta02'
43+
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
44+
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
4445

4546
// compile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
4647
}
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
@@ -153,6 +153,8 @@ public void onPickPhoto() {
153153
.setActivityTitle("Please select media")
154154
.setImageSizeLimit(5)
155155
.setVideoSizeLimit(10)
156+
.setSpan(FilePickerConst.SPAN_TYPE.FOLDER_SPAN, 3)
157+
.setSpan(FilePickerConst.SPAN_TYPE.DETAIL_SPAN, 4)
156158
.enableVideoPicker(true)
157159
.enableCameraSupport(true)
158160
.showGifs(true)
Collapse file

‎app/src/main/res/values/colors.xml‎

Copy file name to clipboard
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="colorPrimary">#0ec608</color>
4-
<color name="colorPrimaryDark">#106e05</color>
5-
<color name="colorAccent">#FF4081</color>
3+
<!-- Light theme colors-->
4+
<color name="colorPrimary">#fafafa</color>
5+
<color name="colorPrimaryDark">#9e9e9e</color>
6+
<color name="colorAccent">@android:color/black</color>
7+
8+
<!-- Dark theme colors-->
9+
<!-- <color name="colorPrimary">#c7006e</color>-->
10+
<!-- <color name="colorPrimaryDark">#880061</color>-->
11+
<!-- <color name="colorAccent">#880061</color>-->
612
</resources>
Collapse file

‎app/src/main/res/values/styles.xml‎

Copy file name to clipboardExpand all lines: app/src/main/res/values/styles.xml
+3-10Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,10 @@
99
</style>
1010

1111
<style name="FilePickerTheme" parent="LibAppTheme">
12-
<!-- Customize your theme here. -->
13-
<item name="colorPrimary">@color/colorPrimary</item>
14-
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
15-
<item name="colorAccent">@color/colorAccent</item>
16-
</style>
12+
<!-- Customize your theme here. set LibAppTheme.Dark for dark themes-->
1713

18-
<style name="PickerTabLayout" parent="Widget.Design.TabLayout">
19-
<item name="tabBackground">@color/colorPrimary</item>
20-
<item name="tabSelectedTextColor">@android:color/white</item>
21-
<item name="tabGravity">fill</item>
22-
<item name="tabMaxWidth">0dp</item>
2314
</style>
2415

16+
17+
2518
</resources>
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/BaseFilePickerActivity.kt‎

Copy file name to clipboardExpand all lines: filepicker/src/main/java/droidninja/filepicker/BaseFilePickerActivity.kt
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ package droidninja.filepicker
33
import android.os.Bundle
44
import androidx.annotation.LayoutRes
55
import androidx.appcompat.app.AppCompatActivity
6-
7-
import androidx.appcompat.widget.Toolbar
6+
import com.google.android.material.appbar.MaterialToolbar
87

98
/**
109
* Created by droidNinja on 22/07/17.
@@ -17,7 +16,7 @@ abstract class BaseFilePickerActivity : AppCompatActivity() {
1716
setTheme(PickerManager.theme)
1817
setContentView(layout)
1918

20-
val toolbar = findViewById<Toolbar>(R.id.toolbar)
19+
val toolbar = findViewById<MaterialToolbar>(R.id.toolbar)
2120
setSupportActionBar(toolbar)
2221
supportActionBar?.setDisplayHomeAsUpEnabled(true)
2322

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
@@ -47,6 +47,16 @@ class FilePickerBuilder {
4747
return this
4848
}
4949

50+
/**
51+
* @param spanType it could be [FilePickerConst.SPAN_TYPE.FOLDER_SPAN] (for folder screen)
52+
* or [FilePickerConst.SPAN_TYPE.DETAIL_SPAN] (for details screen)
53+
* @param count span count in integer, defaults for Folder is 2 and Details is 3
54+
*/
55+
fun setSpan(spanType: FilePickerConst.SPAN_TYPE, count: Int): FilePickerBuilder {
56+
PickerManager.spanTypes[spanType] = count
57+
return this
58+
}
59+
5060
fun setSelectedFiles(selectedPhotos: ArrayList<Uri>): FilePickerBuilder {
5161
mPickerOptionsBundle.putParcelableArrayList(FilePickerConst.KEY_SELECTED_MEDIA, selectedPhotos)
5262
return this

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.