AndroidFilePicker - android library which will help you to pick any type of media file in your application

Overview

AndroidFilePicker

AndroidFilePicker is android library which will help you to pick any type of media file in your application. No need to manage any kind of extra permission or result method override. Just create library class instance and use it or also modify ui as your requirement.

Features:

  • Capture Camera Image
  • Pick Gallery Image Single or Multiple
  • Crop Image (Crop image based on provided aspect ratio or let user choose one)
  • Compress Image (Compress image based on provided compress quality, resolution and format)
  • Handle all runtime permission for camera
  • Does not require storage permission to pick gallery image or capture new image.
  • Capture Camera Video
  • Pick Video from Gallery
  • Pick Specific type of document user need to specify pick document type

Usage

  1. Add the JitPack repository to your project level build file
   allprojects {
   repositories {
       maven { url 'https://jitpack.io' }
   }
}
  1. Add the dependency to your app level build file
dependencies {
	  implementation 'com.github.DhavalBaldhaa:AndroidFilePicker:Tag'
}
  1. Add Provider in manifest file
">


    
        
    

  1. Create AndroidFilePicker instance and show bottom-sheet file picker, Add callback method for retrieve result or error message
AndroidFilePicker.with(APPLICATION_ID)
    .type(selectionType)
    .enableDocumentWithOriginalName()
    .callBack(object : FilePickerCallback {
        override fun onSuccess(media: Media?) {
            handleSelectedMedia(media)
        }

        override fun onSuccess(mediaList: ArrayList<Media>?) {
            handleSelectedMedia(mediaList)
        }

        override fun onError(error: String?) {
            val errorMessage = error ?: "Something Went Wrong"
            Toast.makeText(this@MainActivity, errorMessage, Toast.LENGTH_SHORT)
                .show()
        }
    })
    .start(supportFragmentManager)

Customization

Choose required file type for your file picker selection options (Optional)

  • ALL
    • For all option capture image, pick image, capture video and pick video
      Default selected, if not passed anything file picker works with default value
  • IMAGE
    • For capture image from camera and pick image from gallery
  • VIDEO
    • For capture video from camera and pick video from gallery
  • CAPTURE_IMAGE
    • For capture image from camera
  • CAPTURE_VIDEO
    • Capture video from camera
  • PICK_IMAGE
    • Select image from gallery
  • PICK_VIDEO
    • Select video from gallery
  • TAKE_IMAGE_VIDEO
    • Capture image and video from camera
  • PICK_IMAGE_VIDEO
    • Select image and video from gallery
  • PICK_DOCUMENT
    • Select any type of file as document format
AndroidFilePicker.with(APPLICATION_ID)
    .type(selectionType)
    .start(supportFragmentManager)

Theme Customization

  • Added required color in your color.xml file
#F4F4F4 #ffffff #000000 #000000 #ffffff">

#F4F4F4
#ffffff
#000000
#000000
#ffffff
  • Override bottomsheet theme as per your requirement
false @style/PickerBottomSheet @android:color/transparent @color/colorPrimaryDark true ">


  • Using custom layout xml file (You must need to add all ids with same view, Check demo for more details)
AndroidFilePicker.with(APPLICATION_ID, R.layout.custom_file_picker_layout)
    .start(supportFragmentManager)
  • Specify background resource and text colors for action buttons
AndroidFilePicker.with(APPLICATION_ID)
    .updateTheme(
        R.drawable.button_bg,
        R.color.colorPrimary,
        R.drawable.button_bg_primary,
        R.color.white
    )
    .start(supportFragmentManager)

Methods for enable additional functionality

Method Name Description
type(type: FileSelectionType) Specify file selection option
enableDirectAction() For required direct selection option, Like if you want to direct open camera for capure image and not required to show filepicker ui
enableCrop Enable Cropping functionality and let user choose aspect ratio, By Default crop is disable
(You can visit uCrop lib for customize cropping theme)
crop(x: Float, y: Float) Enable Cropping functionality with fixed Aspect Ratio
cropSquare() Crop square image, its same as crop(1f, 1f)
maxCropResultSize(width: Int, height: Int) Final image resolution will be less than width x height
compressQuality(quality: Int) Specify image compress quality. In 0 to 100 value, 100 means original image
compressedFormat(format: CompressFormat) Set compressed format, like JPEG, PNG, WEBP
setResolutionConstraint(width: Int, height: Int) Final compressed image resolution will be less than width x height
pickDocumentType(type: String) Specify selection document type, "*/*" default value Like
"application/pdf - Only allow to select PDF File
"image/* - Only allow to select image file as document
enableMultiSelection() Required when you want to selected multiple image from gallery
enableDocumentWithOriginalName() Required when you want to select document file with original file name, Default document will select with unique name

Contribution

GitHub contributors

You might also like...
HyperUPnP is Android Application that lets you to Stream Media from PC, NAS or any other device running UPnP/DLNA compliant media server to your Android Device.

Hyper UPnP Android UPnP/DLNA client Stream Media from PC, NAS or any other device running UPnP/DLNA compliant media server to your Android Device. Int

BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.
BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

Pick any of your favorite github repository and create a mini android app showing its details on an android app.
Pick any of your favorite github repository and create a mini android app showing its details on an android app.

Github Browser Pick any of your favorite github repository and create a mini android app showing its details on an android app. Screens navigation gra

A news application through which you can learn and browse all the news that interests you by choosing the country and type of news with the ability to browse and add some news to your favorites
A news application through which you can learn and browse all the news that interests you by choosing the country and type of news with the ability to browse and add some news to your favorites

MY-NEWS-Android A news application through which you can learn and browse all the news that interests you by choosing the country and type of news wit

compaKTset is a small library aimed at providing you with the most memory efficient Set implementation for any particular data type of your choosing.

compaKTset is a small library aimed at providing you with the most memory efficient Set implementation for any particular data type of your choosing.

The WeeBe application is a social media-type app built on Ktor framework

The WeeBe application is a social media-type app built on Ktor framework that allows users to exchange various content connected with mental health, motivation, psychology, and improving oneself. Users can share posts with texts, images, videos, and links, as well as discuss the content in the comment section

A very simple Android app which shows you random memes with the help of meme-api which you can share with your friends!
A very simple Android app which shows you random memes with the help of meme-api which you can share with your friends!

Meme Share A very simple Android app which shows you random memes with the help of meme-api which you can share with your friends! Tech stack 100% wri

The androidx.media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android

AndroidX Media AndroidX Media is a collection of libraries for implementing media use cases on Android, including local playback (via ExoPlayer) and m

Media Provider Manager - An Xposed module intended to prevent media storage abuse
Media Provider Manager - An Xposed module intended to prevent media storage abuse

Media Provider Manager - An Xposed module intended to prevent media storage abuse

Events Calendar is a user-friendly library that helps you achieve a cool Calendar UI with events mapping. You can customise every pixel of the calendar as per your wish and still achieve in implementing all the functionalities of the native android calendar in addition with adding dots to the calendar which represents the presence of an event on the respective dates. It can be done easily, you are just a few steps away from implementing your own badass looking Calendar for your very own project! This is a specified proportion to the size of the Layout or View support library, with which you can easily set a fixed ratio of the size of the Layout or View, internal adaptive size calculation, completely abandon the code to calculate the size! If you have any questions in the course or suggestions, please send an e-mail to the following e-mail, thank you! Photo picker library for android. Let's you pick photos directly from files, or navigate to camera or gallery.
Photo picker library for android. Let's you pick photos directly from files, or navigate to camera or gallery.

ChiliPhotoPicker Made with ❤️ by Chili Labs. Library made without DataBinding, RxJava and image loading libraries, to give you opportunity to use it w

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

ChiliPhotoPicker Made with ❤️ by Chili Labs. Library made without DataBinding, RxJava and image loading libraries, to give you opportunity to use it w

A simple Android utils library to write any type of data into cache files and read them later.

CacheUtilsLibrary This is a simple Android utils library to write any type of data into cache files and then read them later, using Gson to serialize

Pluck - Pluck, a library helps you to pick image  via Galley/Camera built using Compose
Pluck - Pluck, a library helps you to pick image via Galley/Camera built using Compose

Pluck - The image-picker library for Compose This is an image-picker for your je

A small customizable library useful to handle an gallery image pick action built-in your app. :sunrise_over_mountains::stars:
A small customizable library useful to handle an gallery image pick action built-in your app. :sunrise_over_mountains::stars:

Louvre A small customizable image picker. Useful to handle an gallery image pick action built-in your app. *Images from Google Image Search Installati

Automatically generates UI demos which allow users to call any function with any parameters
Automatically generates UI demos which allow users to call any function with any parameters

Automatically generates UI demos which allow users to call any function (including composable ones) with any parameters. Useful for building demo screens in playground apps of various design systems.

☁️🌤🌧☀ Weather Android application that gives you the weather information of your saved location or any region you are looking for☁️🌤🌧☀
☁️🌤🌧☀ Weather Android application that gives you the weather information of your saved location or any region you are looking for☁️🌤🌧☀

☁️🌤🌧☀ Weather Android application that gives you the weather information of your saved location or any region you are looking for☁️🌤🌧☀

Releases(1.0.2)
Owner
null
Easy to use and configurable library to Pick an image from the Gallery or Capture image using Camera.

Easy to use and configurable library to Pick an image from the Gallery or Capture image using Camera.

Simform Solutions 201 Jan 5, 2023
Media Picker is an Android Libary that lets you to select multiple images or video

Media Picker Please let me know if your application go to production via this link Media Picker is an Android Libary that lets you to select multiple

Abdullah Alhazmy 264 Nov 10, 2022
With the Help of this libray you can pic image from camera, gallery, it's support image cropping as well and you can pic PDF

FilePicker This project aims to provide an ultimate and flexible image picking from Gallery, Camera and cropping experience as well as PDF picking fro

Raj Pratap Singh Jadon 3 Nov 24, 2022
A super file picker framework.

一款超强的文件选择框架。A super file picker framework. 功能: 文件选择 支持多种类型文件选择 支持多个文件同时选择 如何添加 Gradle添加: 1.在Project的build.gradle中添加仓库地址

null 7 Jul 16, 2022
Block picker is Android app to help Minecraft player choose blocks for their build.

Block Picker Ever trying to make a build in Minecraft and you just can't find the perfect color palette? Block Picker will help jumpstart your creativ

Ramim Alam 2 May 8, 2022
Built the ccp code on compose. Country Code Picker is an android library which provides an easy way to search and select country or international phone code.

Built the ccp code on compose. Country Code Picker is an android library which provides an easy way to search and select country or international phone code.

utku glsvn 7 Oct 23, 2022
An Android library for picking location in Bangladesh

BDLocationChooser An Android library for picking location in Bangladesh Example Screenshot : Implement Library The library is available on JitPack, fo

Sharif Rafid Ur Rahman 9 Jun 26, 2022
FilePicker - Android library to facilitate files picking up process and ability to convert them to request bodies

FilePicker - Android library to facilitate files picking up process and ability to convert them to request bodies

Ahmed Atwa 26 Dec 14, 2022
Image Picker for Android 🤖

Android Image Picker No config yet highly configurable image picker for Android Screenshot Click to see how image picker looks… Download Add this to y

Esa Firman 1k Jan 7, 2023
Simple, Powerful and Beautiful Android Image/Video/Audio Picker 😎

Simple, Powerful and Beautiful Android Image/Video/Audio Picker ?? Features ?? No need check storage permission ?? Single and multiple selection Suppo

Majid Arabi 34 Jan 2, 2023