GithubHelp home page GithubHelp logo

tchigher / chiliphotopicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chililabs/chiliphotopicker

0.0 0.0 0.0 4.51 MB

Photo picker library for android. Let's you pick photos directly from files, or navigate to camera or gallery.

License: Apache License 2.0

Kotlin 100.00%

chiliphotopicker's Introduction

ChiliPhotoPicker

Library made without DataBinding, RxJava and image loading libraries, to give you opportunity to use it without additional dependencies.

  • Picker styled as bottom sheet dialog
  • Could be used for single or multiple photos pick
  • Allows to choose how images are loaded into ImageView
  • Takes responsibility for all needed permissions
  • Takes responsibility for fetching gallery/camera result
  • Have two built-in themes - Light and Dark
  • Easy custamizable
No permission Single choice Multiple choice

Setup

Gradle:

Add Jitpack to your root build.gradle file:

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

Add dependency to application build.gradle file, where x.y.z is the latest release version:

implementation "com.github.ChiliLabs:ChiliPhotoPicker:x.y.z"

Usage

  • Create new instance of ImagePickerFragment
  • Pass preferred ImageLoader implementation (ready examples for Glide and Picasso are here)
  • Pass built-in or custom theme (by default ChiliPhotoPicker.Light is used)
  • Pass your file provider authority, so we can store temporary photo from camera
  • Show as dialog
ImagePickerFragment.newInstance(multiple = true, allowCamera = true)
            .imageLoader(GlideImageLoader())
            .setTheme(R.style.ChiliPhotoPicker_Dark)
            .authority("com.example.your.fileprovider")
            .show(supportFragmentManager, YOUR_TAG)

ImageLoader

We don't want to depend on many image loading libraries, so we have simple ImageLoader interface, which you can implement using your preferred library (Glide, Picasso, Coil, etc.) We have two working examples of ImageLoader implementations - using Glide and Picasso. You can just copy one of them or write your own implementation

Callback

Picked photos URIs are returned via callbacks onImagesPicked function, so you just need to implement ImagePickerFragment.Callback interface in your activity or fragment

Themes

To customize picker you can use one of built-in themes or inherit it rewriting attributes you want (see example)

Attributes:

  • pickerBackgroundColor - background color
  • pickerPrimaryColor - primary picker color (no permission/empty texts, cancel icon)
  • pickerSecondaryColor - secondary picker color (snackbar)
  • pickerControlColor - color of buttons, icons, checkboxes, ripple
  • pickerGalleryIcon - drawable for Gallery icon (to remove it use @null as attribute value)
  • pickerCameraIcon - drawable for Camera icon (to remove it use @null as attribute value)
  • pickerCornerRadius - background's corners radius
  • pickerDividerColor - color of line below Gallery/Camera buttons

License

Copyright 2019 Chili Labs

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

chiliphotopicker's People

Contributors

aleksandrsorlovs avatar apetjko 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.