-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Image Picker | ||
A Image Picker Library for Android (Supports Android 12) with fully customizable UI | ||
|
||
|
||
# 🔥 Features | ||
* Pick gallery images | ||
* Customizable and Material Design UI | ||
* Supports Android 12 | ||
|
||
|
||
# 🔥 RoadMap | ||
* Capture in Camera Mode (Work in Progress) | ||
* Videos Picker (In Future) | ||
|
||
|
||
# 🔧 Installation | ||
In `settings.gradle` file, add JitPack maven like below: | ||
``` | ||
dependencyResolutionManagement { | ||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | ||
repositories { | ||
... | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
``` | ||
|
||
Add the following dependency in app build.gradle: | ||
``` | ||
dependencies { | ||
implementation 'com.github.nafiskabbo:image-picker:1.0' | ||
} | ||
``` | ||
|
||
|
||
# ⚡ Usage | ||
|
||
Define an `ActivityResultLauncher` class variable in `Activity` or `Fragment`. | ||
```java | ||
private val launcher = registerImagePicker { images -> | ||
// Selected images are ready to use | ||
if(images.isNotEmpty()){ | ||
val sampleImage = images[0] | ||
Glide.with(this@MainActivity) | ||
.load(sampleImage.uri) | ||
.into(imageView) | ||
} | ||
} | ||
``` | ||
|
||
Then, launch image picker when needed. | ||
- With default configuration: | ||
```java | ||
launcher.launch() | ||
``` | ||
- With customize configuration: | ||
```java | ||
val config = ImagePickerConfig( | ||
statusBarColor = "#000000", | ||
isLightStatusBar = false, | ||
isFolderMode = true, | ||
isMultipleMode = true, | ||
maxSize = 10, | ||
rootDirectory = Config.ROOT_DIR_DOWNLOAD, | ||
subDirectory = "Photos", | ||
folderGridCount = GridCount(2, 4), | ||
imageGridCount = GridCount(3, 5), | ||
// See more at configuration attributes table below | ||
) | ||
|
||
launcher.launch(config) | ||
``` | ||
|
||
Configuration attributes | ||
-------- | ||
|
||
| Name | Description | Default | ||
| --- | --- | :---: | | ||
| `statusBarColor` | Status bar color (require API >= 21) | `#000000` | ||
| `isLightStatusBar` | Set status bar to light/dark mode to change it's content to dark/light (require API >= 21) | `false` | ||
| `toolbarColor` | Toolbar color | `#212121` | ||
| `toolbarTextColor` | Toolbar text color | `#FFFFFF` | ||
| `toolbarIconColor` | Toolbar icon color | `#FFFFFF` | ||
| `backgroundColor` | Background color | `#424242` | ||
| `progressIndicatorColor` | Loading indicator color | `#009688` | ||
| `selectedIndicatorColor` | Selected image's indicator color | `#1976D2` | ||
| `isCameraOnly` (Work in Progress) | Open camera, then capture and return an image | `false` | ||
| `isMultipleMode` | Allow to select multiple images | `true` | ||
| `isFolderMode` | Show images by folders | `false` | ||
| `folderGridCount` | Set folder colums for portrait and landscape orientation | `GridCount(2, 4)` | ||
| `imageGridCount` | Set image colums for portrait and landscape orientation | `GridCount(3, 5)` | ||
| `doneTitle` | Done button title | `DONE` | ||
| `folderTitle` | Toolbar title for folder mode (require FolderMode = `true`) | `Albums` | ||
| `imageTitle` | Toolbar title for image mode (require FolderMode = `false`) | `Photos` | ||
| `isShowCamera` (Work in Progress) | Show camera button | `true` | ||
| `isShowNumberIndicator` | Show selected image's indicator as number | `false` | ||
| `isAlwaysShowDoneButton` | Show done button even though no images've been selected yet | `false` | ||
| `rootDirectory` | Public root directory of captured image, should be one of: `RootDirectory.DCIM`, `RootDirectory.PICTURES`, `RootDirectory.DOWNLOADS`. | `RootDirectory.DCIM` | ||
| `subDirectory` | Root directory's sub folder of captured image | Application name | ||
| `maxSize` | Max images can be selected | `Int.MAX_VALUE` | ||
| `limitMessage` | Message to be displayed when total selected images exceeds max size | ... | ||
| `selectedImages` | List of images that will be shown as selected in ImagePicker | Empty list | ||
|
||
|
||
# 💥 Compatibility | ||
|
||
* Library - Android Marshmallow 5.0+ (API 21) | ||
|
||
# ✔️Changelog | ||
|
||
### Version: 1.0 | ||
|
||
* Initial Build | ||
|
||
## 📃 Libraries Used | ||
* Glide [https://github.com/bumptech/glide] - Version 4.12.0 | ||
|
||
## ✨ Contributors | ||
<table> | ||
<tr> | ||
<td align="center"> | ||
<a href="https://github.com/nafiskabbo"> | ||
<img src="https://avatars.githubusercontent.com/u/69830273?v=4" width="100px;" alt=""/><br /> | ||
<sub><b>nafiskabbo</b></sub> | ||
</a> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
|
||
## License | ||
Copyright (c) 2021 Nafis Islam Kabbo |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("kotlin-android") | ||
id("kotlin-kapt") | ||
} | ||
|
||
android { | ||
compileSdk 31 | ||
|
||
defaultConfig { | ||
applicationId "com.kabbodev.imagepicker.demo" | ||
minSdk 21 | ||
targetSdk 31 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
|
||
buildFeatures { | ||
dataBinding true | ||
} | ||
|
||
packagingOptions { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
excludes += "DebugProbesKt.bin" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation(project(":imagepicker")) | ||
|
||
// Android X | ||
implementation("androidx.core:core-ktx:1.7.0") | ||
implementation("androidx.appcompat:appcompat:1.4.0") | ||
implementation("androidx.activity:activity-ktx:1.4.0") | ||
implementation("androidx.fragment:fragment-ktx:1.4.0") | ||
implementation("com.google.android.material:material:1.4.0") | ||
implementation("androidx.constraintlayout:constraintlayout:2.1.2") | ||
|
||
// Glide | ||
implementation("com.github.bumptech.glide:glide:4.12.0") | ||
|
||
// Testing | ||
testImplementation("junit:junit:4.13.2") | ||
androidTestImplementation("androidx.test.ext:junit:1.1.3") | ||
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.kabbodev.imagepicker.demo | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.kabbodev.imagepicker.demo", appContext.packageName) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.kabbodev.imagepicker.demo"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.ImagePicker"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |