Git Product home page Git Product logo

tedbottompicker's Introduction

#What is TedBottomPicker? In Google's Material Design, Google introduce Bottom sheets.(Components – Bottom sheets)
Bottom sheets slide up from the bottom of the screen to reveal more content.

If you want pick image from gallery or take picture, this library can help easily.
TedBottomPicker provide 3 options:

  1. Take a picture by camera(using MediaStore.ACTION_IMAGE_CAPTURE intent)
  2. Get image from gallery(using Intent.ACTION_PICK intent)
  3. Get image from recent image(using MediaStore.Images.Media.EXTERNAL_CONTENT_URI cursor)

TedBottomPicker is simple image picker using bottom sheet.



##Demo

Screenshot Screenshot

  1. Show Bottom Sheet.
  2. Pick Image



##Setup

###Gradle

dependencies {
    compile 'gun0912.ted:tedbottompicker:1.0.3'
}



##How to use ###1. Check Permission You have to grant WRITE_EXTERNAL_STORAGE permission from user.
If your targetSDK version is 23+, you have to check permission and request permission to user.
Because after Marshmallow(6.0), you have to not only decalare permisions in AndroidManifest.xml but also request permissions at runtime.
There are so many permission check library in Android-Arsenal
I recommend TedPermission
TedPermission is super simple and smart permission check library.

###2. Start TedBottomPicker TedBottomPicker class extend BottomSheetDialogFragment.
TedBottomPicker.Builder make new TedBottomPicker().
After then, you can show TedBottomPicker

     TedBottomPicker tedBottomPicker = new TedBottomPicker.Builder(MainActivity.this)
                                .setOnImageSelectedListener(new TedBottomPicker.OnImageSelectedListener() {
                                    @Override
                                    public void onImageSelected(Uri uri) {
                                        // here is selected uri
                                    }
                                })
                                .create();

     tedBottomPicker.show(getSupportFragmentManager());

Don't forget!!
You have to declare setOnImageSelectedListener() in Builder.
This listener will pass selected Uri.


##Customize You can customize something ...

###Function

  • setMaxCount(Int) (default: 25)
  • setPeekHeight(Int)
  • setPeekHeightResId(R.dimen.xxx)
  • showCameraTile(Boolean) (default: true)
  • setCameraTile(R.drawable.xxx or Drawable)
  • setCameraTileBackgroundResId(R.color.xxx)
  • setGalleryTile(R.drawable.xxx or Drawable)
  • showGalleryTile(Boolean) (default: true)
  • setGalleryTileBackgroundResId(R.color.xxx)
  • setSpacing(Int)
  • setSpacingResId(R.dimen.xxx)
  • setOnErrorListener(OnErrorListener)
  • setTitle(String or R.string.xxx) (default: 'Select Image','사진 선택')
  • showTitle(Boolean) (default: true)
  • setTitleBackgroundResId(R.color.xxx)
  • setImageProvider(ImageProvider) : If you want load grid image yourself, you can use your ImageProvider



##Thanks

  • Flipboard-bottomsheet - Android component which presents a dismissible view from the bottom of the screen



##License

Copyright 2016 Ted Park

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.```

tedbottompicker's People

Contributors

gun0912 avatar parksanggwon avatar

Watchers

Naseem Akhtar 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.