Skip to content

Commit

Permalink
customizable colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Majid Arabi committed Feb 28, 2022
1 parent acc79a7 commit d33a1d8
Show file tree
Hide file tree
Showing 23 changed files with 270 additions and 200 deletions.
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@


[![](https://jitpack.io/v/MajidArabi/FilePicker.svg)](https://jitpack.io/#MajidArabi/FilePicker)

## Simple, Powerful and Beautiful Android Image or Video Picker 😎
**Features** 😍
- Check storage permission
- No need check storage permission 😉
- Single and multiple selection
- Supported RTL and LTR list direction (default=LTR)
- Supported image and video (default=image)
- Supported custom title
- Supported custom colors
- Supported dynamic span count (default=2)
- Limit max item selection (default=1)
- Show file directory
- Show file size

## Screenshots

| Sample | Pick Image | Pick Video
| Image | Image | Video
|--|--|--|
| <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" />
| <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" />

## Download

Add it in your root build.gradle at the end of repositories:
Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
repositories {
Expand All @@ -40,14 +39,14 @@ Step 2. Add the dependency
## Usage (Just Kotlin)

FilePicker.show(
activity = this,
gridSpanCount = 3,
cancellable = false,
limitItemSelection = 3,
title = "Select Media",
submitText = "Submit Files",
listDirection = ListDirection.RTL,
fileType = if (video) FileType.VIDEO else FileType.IMAGE,
activity = this,
gridSpanCount = 3,
limitItemSelection = 5,
listDirection = ListDirection.RTL,
fileType = if (video) FileType.VIDEO else FileType.IMAGE,
titleTextColor = ContextCompat.getColor(this, R.color.black),
submitTextColor = ContextCompat.getColor(this, R.color.white),
accentColor = ContextCompat.getColor(this, R.color.purple_200),
) {
// Do something here with selected files
}
Expand All @@ -61,8 +60,8 @@ Step 2. Add the dependency
## Author

**Majid Arabi**
- Github : [@majidarabi](https://github.com/MajidArabi)
- Github: [@majidarabi](https://github.com/MajidArabi)
- Linkedin: [@majidarabi](https://www.linkedin.com/in/majid-arabi-673855129/)
- Telegram: [@one_developer](https://t.me/one_developer)
- Site : http://one-developer.ir
- Email : [email protected]
- Site: http://one-developer.ir
- Email: [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import android.util.Log
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.github.file_picker.FilePicker
import com.github.file_picker.FileType
import com.github.file_picker.ListDirection
Expand All @@ -19,11 +20,14 @@ class MainActivity : AppCompatActivity() {
FilePicker.show(
activity = this,
gridSpanCount = 3,
limitItemSelection = 3,
fileType = if (video) FileType.VIDEO else FileType.IMAGE,
limitItemSelection = 5,
listDirection = ListDirection.RTL,
fileType = if (video) FileType.VIDEO else FileType.IMAGE,
titleTextColor = ContextCompat.getColor(this, R.color.black),
submitTextColor = ContextCompat.getColor(this, R.color.white),
accentColor = ContextCompat.getColor(this, R.color.purple_200),
) {
Log.e("F_PATH", "$it")
Log.e("Files", "$it")
}
video = !video
button.text = if (video) "Show Videos" else "Show Images"
Expand Down
14 changes: 11 additions & 3 deletions file-picker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'io.coil-kt:coil:1.4.0'
implementation 'io.coil-kt:coil-video:1.4.0'

// Coroutines
def coroutine_version = "1.6.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutine_version"

// Glide
def glide_version = "4.13.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
}

afterEvaluate {
Expand All @@ -50,7 +58,7 @@ afterEvaluate {
from components.release
groupId = 'com.github.majidarabi'
artifactId = 'file-picker'
version = '0.0.3'
version = '0.0.4'
}
}
}
Expand Down
14 changes: 13 additions & 1 deletion file-picker/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,16 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
<init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
*** rewind();
}
20 changes: 8 additions & 12 deletions file-picker/src/main/java/com/github/file_picker/Const.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ package com.github.file_picker
import android.os.Parcelable
import kotlinx.parcelize.Parcelize

sealed class FileType : Parcelable {
@Parcelize
object VIDEO : FileType()

@Parcelize
object IMAGE : FileType()
@Parcelize
enum class ListDirection : Parcelable {
LTR,
RTL
}

sealed class ListDirection : Parcelable {
@Parcelize
object LTR : ListDirection()

@Parcelize
object RTL : ListDirection()
@Parcelize
enum class FileType : Parcelable {
VIDEO,
IMAGE
}
Loading

0 comments on commit d33a1d8

Please sign in to comment.