TedBottomPicker


Source link: https://github.com/ParkSangGwon/TedBottomPicker

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 {

  compile 'gun0912.ted:tedbottompicker:1.1.0' 
}
 

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 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());

If you want select multi image, you can use OnMultiImageSelectedListener

 TedBottomPicker bottomSheetDialogFragment = new TedBottomPicker.Builder(MainActivity.this)

  .setOnMultiImageSelectedListener(new TedBottomPicker.OnMultiImageSelectedListener() {

@Override

public void onImagesSelected(ArrayList<Uri> uriList) {

 // here is selected uri list

}

  
}
)

.setPeekHeight(1600)

.showTitle(false)

.setCompleteButtonText("Done")

.setEmptySelectionText("No Select")

.create();

  bottomSheetDialogFragment.show(getSupportFragmentManager());

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


Customize

You can customize something ...

Function

Common

  • showVideoMedia() : Not only load image, but also load video
  • setPreviewMaxCount(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

Single Select

  • setSelectedUri(Uri)

Multi Select

  • setDeSelectIcon(R.drawable.xxx or Drawable)
  • setSelectedForeground(R.drawable.xxx or Drawable)
  • setSelectMaxCount(Int)
  • setSelectMinCount(Int)
  • setCompleteButtonText(String or R.string.xxx) (default: 'Done','??')
  • setEmptySelectionText(String or R.string.xxx) (default: 'No Image','???? ???? ?????')
  • setSelectMaxCountErrorText(String or R.string.xxx)
  • setSelectMinCountErrorText(String or R.string.xxx)
  • setSelectedUriList(ArrayList<Uri>)



Thanks

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



License

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

Resources

Track activities, getCurrentActivity, check whether application is running or not, finish all activities, and so on.

Parallax effect on every item of your RecyclerView.

ProgressedView provides you to show progress when user clicks to any view, and then you're done with the task reverse it back to view again. This view extends RelativeLayout, so it is easy to implement in xml or by code.

This library will provide you to have Parallax effect on every item of your ListView.

APK parser for Android.

Features:

  • Retrieve basic apk metas, such as title, icon, package name, version, etc.
  • Parse and convert binary xml file to text
  • Classes from dex file
  • Get certificate metas and verify apk signature

Android widget that can render PDF documents stored on SD card, linked as assets, or downloaded from a remote URL.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes