Giter Site home page Giter Site logo

nafiskabbo / imagepicker Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 138 KB

📸 Image Picker with Customizable UI for Android, Pick an image from Gallery

Kotlin 100.00%
kotlin-android android-library android image image-picker image-picker-android image-picker-library

imagepicker's Introduction

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:ImagePicker:1.0'
}

⚡ Usage

Define an ActivityResultLauncher class variable in Activity or Fragment.

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:
launcher.launch()
  • With customize configuration:
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

✨ Contributors


nafiskabbo

License

Copyright (c) 2021 Nafis Islam Kabbo

imagepicker's People

Contributors

nafiskabbo avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.