Giter Club home page Giter Club logo

android-image-picker's Introduction

Android Image Picker

No config yet highly configurable image picker for Android

Android Arsenal - ImagePicker jitpack - android image picker

Screenshot

Click to see how image picker looks…

Download

Add this to your project's build.gradle

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

And add this to your module's build.gradle

dependencies {
    implementation 'com.github.esafirm:android-image-picker:x.y.z'
}

change x.y.z to version in the release page

Usage

For full example, please refer to the sample app.

Also you can browse the issue labeled as question here

Start image picker activity

The simplest way to start

val launcher = registerImagePicker {
    // handle result here
}

launcher.launch()

Complete features of what you can do with ImagePicker

val config = ImagePickerConfig {
    mode = ImagePickerMode.SINGLE // default is multi image mode
    language = "in" // Set image picker language
    theme = R.style.ImagePickerTheme

    // set whether pick action or camera action should return immediate result or not. Only works in single mode for image picker
    returnMode = if (returnAfterCapture) ReturnMode.ALL else ReturnMode.NONE

    isFolderMode = folderMode // set folder mode (false by default)
    isIncludeVideo = includeVideo // include video (false by default)
    isOnlyVideo = onlyVideo // include video (false by default)
    arrowColor = Color.RED // set toolbar arrow up color
    folderTitle = "Folder" // folder selection title
    imageTitle = "Tap to select" // image selection title
    doneButtonText = "DONE" // done button text
    limit = 10 // max images can be selected (99 by default)
    isShowCamera = true // show camera or not (true by default)
    savePath = ImagePickerSavePath("Camera") // captured image directory name ("Camera" folder by default)
    savePath =
        ImagePickerSavePath(Environment.getExternalStorageDirectory().path, isRelative = false) // can be a full path

    excludedImages = images.toFiles() // don't show anything on this selected images
    selectedImages = images  // original selected images, used in multi mode
}

If you want to call it outside Activity or Fragment, you can get the Intent with createImagePickerIntent

Please note: handling in onActivityResult is not recommended since it's already deprecated in favor of the new result API

val intent = createImagePickerIntent(context, ImagePickerConfig())
startActivityForResult(intent, RC_IMAGE_PICKER)

Receive result

when you're done picking images, result will be returned on launcher callback with type List<Image>. This list cannot be null but can be empty

val launcher = registerImagePicker { result: List<Image> ->
    result.forEach { image ->
        println(image)
    }
}    

Camera Only

Use CameraOnlyConfig instead of ImagePickerConfig

val launcher = registerImagePicker { }
launcher.launch(CameraOnlyConfig())

You also still can use the DefaultCameraModule but discouraged to do it.

Wiki

Version 2.x.x

If you still use the previous version, you can check 2.x branch in here

Support Me!

I would make myself more commited to this repo and OSS works in general.

Would you help me achieving this goals?

Buy Me a Coffee at ko-fi.com

Credits

License

MIT @ Esa Firman

android-image-picker's People

Contributors

esafirm avatar wiryadev avatar xpdlf1004 avatar thirdegg avatar marekchen avatar kroegerama avatar rainer-lang avatar noordawod avatar alifgiant avatar jayearn avatar chihung93 avatar stu01509 avatar osama-raddad avatar pballart avatar mars885 avatar pavlus avatar pcomans avatar pdavid0 avatar rationalrank avatar rossmansd avatar sblepa avatar sebastian-raubach avatar arok avatar ysoftware avatar yasiralijaved avatar douglasiacovelli avatar hjchin avatar mishbah avatar volail avatar wiwuwa avatar

Stargazers

SHUBHANSHU SINGH 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.