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

Overview

FilePicker

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

The goal of this app is to get rid of the hassle of file picking up handling and reduce effort made in uploading them to server without the need to ask use for a single permission.

Features:

  • Launch different file types picking intents/requests (Image, Pdf and File for general).
  • Get a callback with bitmap in case of image alongside with file object.
  • Get a callback with a fileName incase of Pdf & File alongside with file object.
  • Convert picked up files to request bodies to usethem with api requests to upload them to server,.
  • Not a single permission is required.

Dependency :

dependencies {
      implementation 'com.github.atwa:filepicker:1.0.0'
  }

Usage :

  • Image picking
    fun pickImage() {
          FilePicker.getInstance().pickImage(this) { result ->
              val bitmap : Bitmap? = result?.first
              val file : File? = result?.second
          }
      }
    
  • Pdf picking
    fun pickPdf() {
          FilePicker.getInstance().pickPdf(this) { result ->
              val name: String? = result?.first
              val file: File? = result?.second
          }
      }
    
  • File picking
    fun pickFile() {
          FilePicker.getInstance().pickFile(this) { result ->
              val name : String? = result?.first
              val file : File? = result?.second
          }
      }
    
  • File converting to request body
    fun convertFile() {
          val file: File = File("file")
          val requestBody: RequestBody = FileConverter.getInstance()
              .toRequestBody(FileConverter.getInstance().fileMediaType, file)
      }
    

Contribution

Please feel free to make a pull request or fork.

Rate

If you find this repository useful please give it a star .

You might also like...
Text-array-process - A home assignment used during the recruitment process at Lumera

Rules to implement class={isogram|palindrome|semordnilap} maxlength=INT minl

FilePicker is a small and fast file selector library that is constantly evolving with the goal of rapid integration, high customization, and configurability~
FilePicker is a small and fast file selector library that is constantly evolving with the goal of rapid integration, high customization, and configurability~

Android File Picker 🛩️ 中文简体 Well, it doesn't have a name like Rocky, Cosmos or Fish. Android File Picker, like its name, is a local file selector fra

LiteHttp is a simple, intelligent and flexible HTTP framework for Android. With LiteHttp you can make HTTP request with only one line of code! It could convert a java model to the parameter and rander the response JSON as a java model intelligently.

Android network framework: LiteHttp Tags : litehttp2.x-tutorials Website : http://litesuits.com QQgroup : 42960650 , 47357508 Android网络通信为啥子选 lite-htt

Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mic)
Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mic)

Speech-Text Converter About Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mi

API-Request - Android app that makes API Request

API-Request Android project using Retrofit and Ktor for Http Requests, built wit

A simple gradle plugin that lets you create a download asset from zeplin and convert them to vector drawables automatically
A simple gradle plugin that lets you create a download asset from zeplin and convert them to vector drawables automatically

A simple gradle plugin that lets you create a download asset from zeplin and convert them to vector drawables automatically elephant project using 100% Kotlin and be up and running in a few seconds.

Convert audio files inside your Android app easily. Supported formats: AAC, MP3, M4A, WMA, WAV and FLAC.

AndroidAudioConverter Convert audio files inside your Android app easily. This is a wrapper of FFmpeg-Android-Java lib. Supported formats: AAC MP3 M4A

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

A set of TestRules and ActivityScenarios to facilitate UI Testing under given configurations: FontSizes, Locales

AndroidUiTestingUtils A set of TestRules, ActivityScenarios and utils to facilit

A set of Android tools that facilitate apps development
A set of Android tools that facilitate apps development

A set of Android tools that facilitate apps development Well, this repo contains pretty much code used internally at Stanfy to develop Android apps. S

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

 KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP)
KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP)

KaMP Kit Welcome to the KaMP Kit! About Goal The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP). It is a coll

The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform
The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform

KaMP Kit Welcome to the KaMP Kit! About Goal The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP). It is a coll

Account-lib - A suite of libraries to facilitate the usage of account-sdk

Usage Clone this repository (skip this step if the repo is on your local machine). The default branch is fine. git clone https://github.com/AFBlockcha

Application to facilitate the allocation of over quotas of the subjects of a career in a practical
Application to facilitate the allocation of over quotas of the subjects of a career in a practical

Application to facilitate the allocation of over quotas of the subjects of a career in a practical, intuitive and equitable way among students who were left without a quota at the time of enrollment.

Android library for drawing Pie charts and Donut charts with the ability to customize almost anything in it.
Android library for drawing Pie charts and Donut charts with the ability to customize almost anything in it.

A Pie/Donut*/Ring chart for Android, customizable to the most extent possible. For tutorial and examples refer to the website. build.gradle[.kts] impl

SimpleApiCalls is a type-safe REST client for Android. The library provides the ability to interact with APIs and send network requests with HttpURLConnection.

SimpleApiCalls 📢 SimpleApiCalls is a type-safe REST client for Android. The library provides the ability to interact with APIs and send network reque

A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML
A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML

A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. It aims to be a testing lib, but can also be used to scrape websites in a convenient fashion.

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

Comments
  • [Feature request] Get photo from camera

    [Feature request] Get photo from camera

    Would be great to have ability to take photo from camera using this library

    val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE).apply { addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION) putExtra(MediaStore.EXTRA_OUTPUT, outputUri) }

    And interface like: fun pickImageFromCamera(outputUri: Uri, onImagePicked: (Pair<Bitmap?, File?>?) -> Unit)

    opened by cempo 7
  • registerForActivityResult should be scalled before your activity is created

    registerForActivityResult should be scalled before your activity is created

    I'm getting error when launch a picker

    LifecycleOwner MyActivity is attempting to register while current state is RESUMED. LifecycleOwners must call register before they are STARTED.

    Reason: Related to android documentation, registerForActivityResult() is safe to call before your fragment or activity is created

    How to do it for this library?

    opened by cempo 3
  • use in fragment

    use in fragment

    Hi Atwa how to use this methods in fragment? when I use in fragment , I get this Err:

    java.lang.IllegalStateException: LifecycleOwner MyPakageName.ui.MainActivity@69347ae is attempting to register while current state is RESUMED. LifecycleOwners must call register before they are STARTED.

    thanks

    opened by marzieNoor 4
  • app icon override

    app icon override

    Hi Atwa, There is a problem with ic_launcher under anydpi-v26 folders that override icon apps when using the library, I think ic_launcher should be removed as it's a library project. what do you think? Regards

    opened by Androbito 1
Releases(1.0.4-alpha2)
Owner
Ahmed Atwa
Enthusiastic Android developer with 6 years of experience in developing and building robust apps following clean code principles and responsive UI .
Ahmed Atwa
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
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
Unicorn File Picker is a library designed to package a powerful file selector for android.

A simple, documented, and contribution-friendly File Picker for Android.

Abhishek Tiwari 62 Dec 5, 2022
AndroidFilePicker - android library which will help you to pick any type of media file in your application

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.

null 4 Sep 12, 2022
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
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
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
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
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
Base on android-process-button this is the advanced version of the android-process-button.

Rock Button release log Base on android-process-button this is the advanced version of the android-process-button ##Main Features ActionProcessButton

MDCCLXXVI KPT 119 Nov 25, 2022