Skip to content

Commit d33a1d8

Browse files
author
Majid Arabi
committed
customizable colors
1 parent acc79a7 commit d33a1d8

File tree

23 files changed

+270
-200
lines changed

23 files changed

+270
-200
lines changed

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
2-
31
[![](https://jitpack.io/v/MajidArabi/FilePicker.svg)](https://jitpack.io/#MajidArabi/FilePicker)
42

53
## Simple, Powerful and Beautiful Android Image or Video Picker 😎
64
**Features** 😍
7-
- Check storage permission
5+
- No need check storage permission 😉
86
- Single and multiple selection
97
- Supported RTL and LTR list direction (default=LTR)
108
- Supported image and video (default=image)
119
- Supported custom title
10+
- Supported custom colors
1211
- Supported dynamic span count (default=2)
1312
- Limit max item selection (default=1)
1413
- Show file directory
1514
- Show file size
1615

1716
## Screenshots
1817

19-
| Sample | Pick Image | Pick Video
18+
| Image | Image | Video
2019
|--|--|--|
21-
| <img src="https://github.com/MajidArabi/FilePicker/blob/master/screenshots/sample.png" width="250" /> | <img src="https://github.com/MajidArabi/FilePicker/blob/master/screenshots/pick-image.png" width="250" /> | <img src="https://github.com/MajidArabi/FilePicker/blob/master/screenshots/pick-video.png" width="250" />
20+
| <img src="https://github.com/MajidArabi/FilePicker/blob/master/screenshots/image-2col-full.jpg" width="250" /> | <img src="https://github.com/MajidArabi/FilePicker/blob/master/screenshots/image-3col.jpg" width="250" /> | <img src="https://github.com/MajidArabi/FilePicker/blob/master/screenshots/video-2col-full.jpg" width="250" />
2221

2322
## Download
2423

25-
Add it in your root build.gradle at the end of repositories:
24+
Step 1. Add it in your root build.gradle at the end of repositories:
2625

2726
allprojects {
2827
repositories {
@@ -40,14 +39,14 @@ Step 2. Add the dependency
4039
## Usage (Just Kotlin)
4140

4241
FilePicker.show(
43-
activity = this,
44-
gridSpanCount = 3,
45-
cancellable = false,
46-
limitItemSelection = 3,
47-
title = "Select Media",
48-
submitText = "Submit Files",
49-
listDirection = ListDirection.RTL,
50-
fileType = if (video) FileType.VIDEO else FileType.IMAGE,
42+
activity = this,
43+
gridSpanCount = 3,
44+
limitItemSelection = 5,
45+
listDirection = ListDirection.RTL,
46+
fileType = if (video) FileType.VIDEO else FileType.IMAGE,
47+
titleTextColor = ContextCompat.getColor(this, R.color.black),
48+
submitTextColor = ContextCompat.getColor(this, R.color.white),
49+
accentColor = ContextCompat.getColor(this, R.color.purple_200),
5150
) {
5251
// Do something here with selected files
5352
}
@@ -61,8 +60,8 @@ Step 2. Add the dependency
6160
## Author
6261

6362
**Majid Arabi**
64-
- Github : [@majidarabi](https://github.com/MajidArabi)
63+
- Github: [@majidarabi](https://github.com/MajidArabi)
6564
- Linkedin: [@majidarabi](https://www.linkedin.com/in/majid-arabi-673855129/)
6665
- Telegram: [@one_developer](https://t.me/one_developer)
67-
- Site : http://one-developer.ir
68-
- Email : majidarabi73@gmail.com
66+
- Site: http://one-developer.ir
67+
- Email: majidarabi73@gmail.com

app/src/main/java/ir/one_developer/filepickerlibrary/MainActivity.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.os.Bundle
44
import android.util.Log
55
import android.widget.TextView
66
import androidx.appcompat.app.AppCompatActivity
7+
import androidx.core.content.ContextCompat
78
import com.github.file_picker.FilePicker
89
import com.github.file_picker.FileType
910
import com.github.file_picker.ListDirection
@@ -19,11 +20,14 @@ class MainActivity : AppCompatActivity() {
1920
FilePicker.show(
2021
activity = this,
2122
gridSpanCount = 3,
22-
limitItemSelection = 3,
23-
fileType = if (video) FileType.VIDEO else FileType.IMAGE,
23+
limitItemSelection = 5,
2424
listDirection = ListDirection.RTL,
25+
fileType = if (video) FileType.VIDEO else FileType.IMAGE,
26+
titleTextColor = ContextCompat.getColor(this, R.color.black),
27+
submitTextColor = ContextCompat.getColor(this, R.color.white),
28+
accentColor = ContextCompat.getColor(this, R.color.purple_200),
2529
) {
26-
Log.e("F_PATH", "$it")
30+
Log.e("Files", "$it")
2731
}
2832
video = !video
2933
button.text = if (video) "Show Videos" else "Show Images"

file-picker/build.gradle

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ dependencies {
3939
implementation 'androidx.appcompat:appcompat:1.4.1'
4040
implementation 'androidx.recyclerview:recyclerview:1.2.1'
4141
implementation 'com.google.android.material:material:1.5.0'
42-
implementation 'io.coil-kt:coil:1.4.0'
43-
implementation 'io.coil-kt:coil-video:1.4.0'
42+
43+
// Coroutines
44+
def coroutine_version = "1.6.0"
45+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
46+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutine_version"
47+
48+
// Glide
49+
def glide_version = "4.13.0"
50+
implementation "com.github.bumptech.glide:glide:$glide_version"
51+
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
4452
}
4553

4654
afterEvaluate {
@@ -50,7 +58,7 @@ afterEvaluate {
5058
from components.release
5159
groupId = 'com.github.majidarabi'
5260
artifactId = 'file-picker'
53-
version = '0.0.3'
61+
version = '0.0.4'
5462
}
5563
}
5664
}

file-picker/proguard-rules.pro

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,16 @@
1818

1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
21+
#-renamesourcefileattribute SourceFile
22+
23+
-keep public class * implements com.bumptech.glide.module.GlideModule
24+
-keep class * extends com.bumptech.glide.module.AppGlideModule {
25+
<init>(...);
26+
}
27+
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
28+
**[] $VALUES;
29+
public *;
30+
}
31+
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
32+
*** rewind();
33+
}

file-picker/src/main/java/com/github/file_picker/Const.kt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@ package com.github.file_picker
33
import android.os.Parcelable
44
import kotlinx.parcelize.Parcelize
55

6-
sealed class FileType : Parcelable {
7-
@Parcelize
8-
object VIDEO : FileType()
9-
10-
@Parcelize
11-
object IMAGE : FileType()
6+
@Parcelize
7+
enum class ListDirection : Parcelable {
8+
LTR,
9+
RTL
1210
}
1311

14-
sealed class ListDirection : Parcelable {
15-
@Parcelize
16-
object LTR : ListDirection()
17-
18-
@Parcelize
19-
object RTL : ListDirection()
12+
@Parcelize
13+
enum class FileType : Parcelable {
14+
VIDEO,
15+
IMAGE
2016
}

0 commit comments

Comments
 (0)