Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Update gradle #67

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 111 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
![](library_banner.png)

# 📸 SSImagePicker

[![](https://jitpack.io/v/SimformSolutionsPvtLtd/SSImagePicker.svg)](https://jitpack.io/#SimformSolutionsPvtLtd/SSImagePicker)
Expand All @@ -7,13 +8,17 @@
[![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23473-orange)](https://androidweekly.net/issues/issue-473)
[![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-SSImagePicker-green.svg?style=flat )]( https://android-arsenal.com/details/1/8243 )

Easy to use and configurable library to **Pick multiple images from the Gallery or Capture an image using Camera with maximum size, extension, crop, rotate, zoom and compress features**.
Easy to use and configurable library to **Pick multiple images from the Gallery or Capture an image
using Camera with maximum size, extension, crop, rotate, zoom and compress features**.

* You can easily select image from camera and gallery and upload it wherever you want. We have created this library to simplify pick or capture image feature.
* You can easily select image from camera and gallery and upload it wherever you want. We have
created this library to simplify pick or capture image feature.
* Handled permissions for camera and gallery, also supports scoped storage.
* Returns contentUri of selected image.
* Easy to use and supports all major devices.
* Support for new [Photo Picker](https://developer.android.com/training/data-storage/shared/photopicker) for Android 11+.
* Support for
new [Photo Picker](https://developer.android.com/training/data-storage/shared/photopicker) for
Android 11+.

# :zap: Features :

Expand All @@ -34,152 +39,172 @@ Easy to use and configurable library to **Pick multiple images from the Gallery

# 🎬Preview

| Camera Picker | Gallery Picker | Multi Selection Gallery Picker |
|--|--|--|
| Camera Picker | Gallery Picker | Multi Selection Gallery Picker |
|-----------------------------|------------------------------|---------------------------------------|
| ![](gifs/camera_picker.gif) | ![](gifs/gallery_picker.gif) | ![](gifs/gallery_multi_selection.gif) |

| Picker Option Bottom Sheet | Crop Options | Extension Options |
|--|--|--|
| Picker Option Bottom Sheet | Crop Options | Extension Options |
|------------------------------------------|----------------------------|---------------------------------|
| ![](gifs/picker_option_bottom_sheet.gif) | ![](gifs/crop_options.gif) | ![](gifs/extension_options.gif) |

| System Photo Picker (Android 11+) |
|--|
|-----------------------------------|
| ![](gifs/system_photo_picker.gif) |

# :books: How it works:

1. Gradle Dependency

* Add the JitPack repository to your project's build.gradle file
- For Gradle version 5.x.x or less
```groovy
- For Gradle version 5.x.x or less

```kotlin
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
maven { url = "https://jitpack.io" }
}
}
```
- For Gradle version 6.x.x and above, in **settings.gradle** file inside **`pluginManagement`** block

```groovy
pluginManagement {
- For latest Android Studio, in **settings.gradle** file
inside **`dependencyResolutionManagement`** block

```kotlin
dependencyResolutionManagement {
repositories {
...
maven { url 'https://jitpack.io' }
maven { url = "https://jitpack.io" }
}
}
```

* Enable data binding feature in your app's build.gradle file [(More Details)](https://developer.android.com/topic/libraries/data-binding/start#build_environment).
```groovy
* Enable data binding feature in your app's build.gradle
file [(More Details)](https://developer.android.com/topic/libraries/data-binding/start#build_environment)
.
```kotlin
android {
...
buildFeatures {
dataBinding true
dataBinding=true
}
}
```

* Add the dependency in your app's build.gradle file

```groovy
```kotlin
dependencies {
implementation 'com.github.SimformSolutionsPvtLtd:SSImagePicker:2.0'
implementation("com.github.SimformSolutionsPvtLtd:SSImagePicker:2.0")
}
```
2. Add ImagePickerActivity into your AndroidManifest.xml. **`SSImagePicker`** is default theme for image picker activity. If you want to set custom theme check out [customization guide](docs/picker_ui_customization.md). Make sure to add the **`android:configChanges`** to handle the rotation.

2. Add ImagePickerActivity into your AndroidManifest.xml. **`SSImagePicker`** is default theme for
image picker activity. If you want to set custom theme check
out [customization guide](docs/picker_ui_customization.md). Make sure to add
the **`android:configChanges`** to handle the rotation.

```xml
<activity
android:name="com.app.imagepickerlibrary.ui.activity.ImagePickerActivity"
android:configChanges="orientation|screenSize"
android:theme="@style/SSImagePicker" />

<activity android:name="com.app.imagepickerlibrary.ui.activity.ImagePickerActivity"
android:configChanges="orientation|screenSize" android:theme="@style/SSImagePicker" />
```

3. If you want to use Picker options bottom sheet then implement **`SSPickerOptionsBottomSheet.ImagePickerClickListener`** in your fragment or activity. **`onImageProvider`** method will give the selected provider type.
3. If you want to use Picker options bottom sheet then
implement **`SSPickerOptionsBottomSheet.ImagePickerClickListener`** in your fragment or
activity. **`onImageProvider`** method will give the selected provider type.

```kotlin
val pickerOptionBottomSheet = SSPickerOptionsBottomSheet.newInstance()
pickerOptionBottomSheet.show(supportFragmentManager,"tag")
....
override fun onImageProvider(provider: ImageProvider) {
when (provider) {
ImageProvider.GALLERY -> {
//Open gallery
}
ImageProvider.CAMERA -> {
//Open camera
}
ImageProvider.NONE -> {}
pickerOptionBottomSheet.show(supportFragmentManager, "tag")
....
override fun onImageProvider(provider: ImageProvider) {
when (provider) {
ImageProvider.GALLERY -> {
//Open gallery
}
ImageProvider.CAMERA -> {
//Open camera
}
ImageProvider.NONE -> {}
}
}
```

4. Open Image Picker from activity or fragment via registering the image picker. It will give object of **`ImagePicker`** class.
4. Open Image Picker from activity or fragment via registering the image picker. It will give object
of **`ImagePicker`** class.

```kotlin
private val imagePicker: ImagePicker by lazy {
registerImagePicker(this)
}
registerImagePicker(this)
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
}
//To display the picker screen call open method on image picker object passing the picker type.
imagePicker.open(PickerType.GALLERY)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
}

//To display the picker screen call open method on image picker object passing the picker type.
imagePicker.open(PickerType.GALLERY)
```

5. Add customization to image picker via the image picker object. Checkout all the methods and default values for customization from the [picker config customization](docs/picker_config.md) section.
5. Add customization to image picker via the image picker object. Checkout all the methods and
default values for customization from the [picker config customization](docs/picker_config.md)
section.

```kotlin
imagePicker
.title("My Picker")
.multipleSelection(enable = true, maxCount = 5)
.showCountInToolBar(false)
.showFolder(true)
.cameraIcon(true)
.doneIcon(true)
.allowCropping(true)
.compressImage(false)
.maxImageSize(2)
.extension(PickExtension.JPEG)
imagePicker.open(PickerType.GALLERY)
.title("My Picker")
.multipleSelection(enable = true, maxCount = 5)
.showCountInToolBar(false)
.showFolder(true)
.cameraIcon(true)
.doneIcon(true)
.allowCropping(true)
.compressImage(false)
.maxImageSize(2)
.extension(PickExtension.JPEG)
imagePicker.open(PickerType.GALLERY)
```

6. To get result in activity or fragment implement **`ImagePickerResultListener`**.

```kotlin
class MainActivity : AppCompatActivity(), ImagePickerResultListener {
...
}
...
}
```

7. Single Selection and the image captured from camera will be received in
**`onImagePick(uri: Uri?)`** callback.

```kotlin
override fun onImagePick(uri: Uri?) {
//Do something with uri
}
//Do something with uri
}
```

8. Multiple Selection uris will be received in **`onMultiImagePick(uris: List<Uri>?)`** callback.

```kotlin
override fun onMultiImagePick(uris: List<Uri>?) {
//Do something with uris
}
//Do something with uris
}
```

# :art: Customization

- Customize picker config for different available options - [:books: Picker Config Guide](docs/picker_config.md)
- Customize UI of picker screen with different style attributes - [:books: Picker Screen UI Guide](docs/picker_ui_customization.md)
- Customize UI of picker options bottom sheet with different style attributes - [:books: Picker Options Bottom Sheet Guide](docs/options_bottom_sheet_customization.md)
- Customize picker config for different available options
- [:books: Picker Config Guide](docs/picker_config.md)
- Customize UI of picker screen with different style attributes
- [:books: Picker Screen UI Guide](docs/picker_ui_customization.md)
- Customize UI of picker options bottom sheet with different style attributes
- [:books: Picker Options Bottom Sheet Guide](docs/options_bottom_sheet_customization.md)

# :pencil: Permissions

**SSImagePicker** Uses following permissions to display images. For system [Photo Picker](https://developer.android.com/training/data-storage/shared/photopicker) on Android 11+ no permission is required.
**SSImagePicker** Uses following permissions to display images. For
system [Photo Picker](https://developer.android.com/training/data-storage/shared/photopicker) on
Android 11+ no permission is required.

* API **21(Android 5)** to API **32(Android 12L)**: `android.permission.READ_EXTERNAL_STORAGE`
* API **33(Android 13)** onwards: `android.permission.READ_MEDIA_IMAGES`
Expand All @@ -189,23 +214,33 @@ Easy to use and configurable library to **Pick multiple images from the Gallery
- Checkout the migration [guide](docs/migration.md) for migration to the latest version.

## Other Library used:

* __[UCrop Library](https://github.com/Yalantis/uCrop)__

## Find this library useful? :heart:
Support it by joining __[stargazers](https://github.com/SimformSolutionsPvtLtd/SSImagePicker/stargazers)__ for this repository. :star:

Support it by
joining __[stargazers](https://github.com/SimformSolutionsPvtLtd/SSImagePicker/stargazers)__ for
this repository. :star:

## 🤝 How to Contribute

Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! :muscle:
Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! :
muscle:

Check out our [**Contributing Guide**](https://github.com/SimformSolutionsPvtLtd/SSImagePicker/blob/master/CONTRIBUTING.md) for ideas on contributing.
Check out our [**Contributing
Guide**](https://github.com/SimformSolutionsPvtLtd/SSImagePicker/blob/master/CONTRIBUTING.md) for
ideas on contributing.

## Bugs and Feedback

For bugs, feature requests, and discussion please use [GitHub Issues](https://github.com/SimformSolutionsPvtLtd/SSImagePicker/issues).
For bugs, feature requests, and discussion please
use [GitHub Issues](https://github.com/SimformSolutionsPvtLtd/SSImagePicker/issues).

## Awesome Mobile Libraries
- Check out our other available [awesome mobile libraries](https://github.com/SimformSolutionsPvtLtd/Awesome-Mobile-Libraries)

- Check out our other
available [awesome mobile libraries](https://github.com/SimformSolutionsPvtLtd/Awesome-Mobile-Libraries)

## License

Expand Down
16 changes: 7 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ plugins {
}

android {
compileSdk = Versions.COMPILE_SDK
compileSdk = libs.versions.compile.sdk.get().toInt()
namespace = App.ID
defaultConfig {
applicationId = App.ID
minSdk = Versions.MIN_SDK
targetSdk = Versions.TARGET_SDK
versionCode = App.Version.CODE
versionName = App.Version.NAME
minSdk = libs.versions.min.sdk.get().toInt()
targetSdk = libs.versions.target.sdk.get().toInt()
versionCode = libs.versions.version.code.get().toInt()
versionName = libs.versions.version.name.get()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled = App.MULTI_DEX
javaCompileOptions {
Expand All @@ -27,17 +27,15 @@ android {
getByName(App.BuildType.RELEASE) {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
manifestPlaceholders["enableCrashReporting"] = true
}

getByName(App.BuildType.DEBUG) {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
manifestPlaceholders["enableCrashReporting"] = false
}
Expand Down
9 changes: 0 additions & 9 deletions buildSrc/src/main/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ object App {
const val ID = "com.ssimagepicker.app"
const val MULTI_DEX = true

object Version {
const val CODE = 1
const val NAME = "1.8"
}

object Dimension {
const val DEFAULT = "default"
}

object BuildType {
const val RELEASE = "release"
const val DEBUG = "debug"
Expand Down
5 changes: 0 additions & 5 deletions buildSrc/src/main/kotlin/ClassPaths.kt

This file was deleted.

20 changes: 0 additions & 20 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,4 @@ object Versions {
const val MIN_SDK = 21
const val TARGET_SDK = 34

const val APPCOMPAT = "1.5.1"
const val ACTIVITY_KTX = "1.6.1"
const val ANDROID_GRADLE = "7.2.2"
const val ARCH_CORE_TESTING = "2.1.0"
const val CORE_KTX = "1.9.0"
const val CONSTRAINT_LAYOUT = "2.0.4"
const val ESPRESSO_CORE = "3.2.0"
const val FRAGMENT_KTX = "1.5.5"
const val GLIDE = "4.12.0"
const val JUNIT = "4.13"
const val JUNIT_EXT = "1.1.1"
const val KOTLIN_GRADLE = "1.7.0"
const val BINTRAY = "1.8.0"
const val LIFECYCLE = "2.5.1"
const val MATERIAL = "1.3.0"
const val TEST_RUNNER = "1.1.1"
const val TEST_RULES = "1.1.1"
const val INTUIT_SSP = "1.0.6"
const val INTUIT_SDP = "1.0.6"
const val RECYCLER_VIEW = "1.2.1"
}
Loading