TedBottomPicker

Additional

Language
Java
Version
1.0.1-beta2 (Aug 30, 2016)
Created
Aug 30, 2016
Updated
Feb 19, 2019
Owner
Ted Park (ParkSangGwon)
Contributors
Ted Park (ParkSangGwon)
gun0912
Rohit Shampur (rohitshampur)
akichusell
majidkabir
gtcompscientist
6
Activity
Badge
Generate
Download
Source code
APK file

Advertising

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



  1. Show Bottom Sheet.
  2. Pick Image

Single/Multi Select



Setup

Gradle

dependencies {
    implementation 'gun0912.ted:tedbottompicker:x.y.z'
    //implementation 'gun0912.ted:tedbottompicker:2.0.0-alpha1'
}

If you think this library is useful, please press star button at upside.



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 There are so many permission check library in Android-Arsenal I recommend TedPermission
TedPermission is super simple and smart permission check library.


AndroidManifest.xml but also request permissions at runtime.



2. Start TedBottomPicker

  • TedBottomPicker support RxJava and Listener style

RxJava

You have to use TedRxBottomPicker

  • Single image
        TedRxBottomPicker.with(MainActivity.this)
                 .show()
                 .subscribe(uri ->
                    // here is selected image uri
                 }, Throwable::printStackTrace);

  • Multi image
        
        TedRxBottomPicker.with(MainActivity.this)
                //.setPeekHeight(getResources().getDisplayMetrics().heightPixels/2)
                .setPeekHeight(1600)
                .showTitle(false)
                .setCompleteButtonText("Done")
                .setEmptySelectionText("No Select")
                .setSelectedUriList(selectedUriList)
                .showMultiImage()
                .subscribe(uris -> {
                   // here is selected image uri list
                }, Throwable::printStackTrace);



Listener

You have to use TedBottomPicker

  • Single image
        TedBottomPicker.with(MainActivity.this)
               .show(new TedBottomSheetDialogFragment.OnImageSelectedListener() {
                   @Override
                   public void onImageSelected(Uri uri) {
                     // here is selected image uri
                   }
               });
  • Multi image
        TedBottomPicker.with(MainActivity.this)
               .setPeekHeight(1600)
               .showTitle(false)
               .setCompleteButtonText("Done")
               .setEmptySelectionText("No Select")
               .setSelectedUriList(selectedUriList)
               .showMultiImage(new TedBottomSheetDialogFragment.OnMultiImageSelectedListener() {
                    @Override
                    public void onImagesSelected(List<Uri> uriList) {
                         // here is selected image uri list
                    }
              });