Unicorn File Picker is a library designed to package a powerful file selector for android.

Overview

Unicorn File Picker

CircleCI Download Android Arsenal

Unicorn File Picker is a library designed to package a powerful file selector for android. You can:

  • Start the file picker activity from any activity or fragment
  • Select single or multiple files
  • Use as a Directory Picker
  • Filter out files you want to display
  • Add custom theme or use default theme options (Light & Dracula)
  • And much more which you have to try out for yourself
Unicorn Dracula Unicorn Default Custom Theme

Download

Gradle:

repositories {
    maven { url ‘https://jitpack.io’ }
}

dependencies {
    implementation 'com.github.abhishekti7:UnicornFilePicker:$latest_version'
}

How do I use Unicorn File Picker?

Permission

The library requires two permissions:

  • android.permission.READ_EXTERNAL_STORAGE
  • android.permission.WRITE_EXTERNAL_STORAGE

If you are targeting Android 6.0+, you need to handle runtime permission request before next step.

Also, don't forget to add requestlegacyexternalstorage=true for Android 10.

Simple usage snippet


Start UnicornFilePicker from current Activity or Fragment:

UnicornFilePicker.from(MainActivity.this)
                    .addConfigBuilder()
                    .selectMultipleFiles(false)
                    .showOnlyDirectory(true)
                    .setRootDirectory(Environment.getExternalStorageDirectory().getAbsolutePath())
                    .showHiddenFiles(false)
                    .setFilters(new String[]{"pdf", "png", "jpg", "jpeg"})
                    .addItemDivider(true)
                    .theme(R.style.UnicornFilePicker_Dracula)
                    .build()
                    .forResult(Constants.REQ_UNICORN_FILE);

Themes

There are two built-in themes you can use to start UnicornFilePicker:

  • R.style.UnicornFilePicker_Default (light mode)
  • R.style.UnicornFilePicker_Dracula (dark mode)

You can also define your own custom theme.

Receive Result

In onActivityResult() callback of the starting Activity or Fragment:

List<String> mSelected_files;

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) {
        ArrayList<String> files = data.getStringArrayListExtra("filePaths");
        for(String file : files){
            Log.e(TAG, file);
        }
    }
}

PLEASE NOTE:

API >= 21 && API <=28

The file picker works great on legacy android versions and there's is no need for any additional configuration.

API 29

You need to add the following line to your manifest file if you want to use this picker on android 10 for atleast a few months.

    android:requestLegacyExternalStorage="true"

This line indicates to the operating system that we want to opt out of the new Scoped Storage system.

API > 29 (WIP)

Unfortunately this library has no stable support for file access on Android 11+. Behaviour noticed on Android 11 -> While the file picker works, the only files that are displayed are the media files which include images, videos, audio, etc. This is because of the introduction of the Google's infamous new storage model called Scoped Storage which aims to improve file security. You can read all about this here: Scoped Storage

This feature is currently a work-in-progress along with many other awesome things on the roadmap. If you feel you can add value to this feature then please see the section on Contributing.


Contributing

UnicornFilePicker is an Open Source Project

LICENSE

Copyright [2021] [Abhishek Tiwari]

   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.
Comments
  • showOnlyDir not implemented ??

    showOnlyDir not implemented ??

    Hi, I appreciate your work : this chooser is fine and light, easy to implement ! But it seems that setShowOnlyDir(true) is not working (this parameter not recognized at compile time) Is this functionality implemented ?

    opened by jplente 7
  • REQUEST_CODE_CHOOSE constant unresolved in Kotlin translation

    REQUEST_CODE_CHOOSE constant unresolved in Kotlin translation

    Hi, I'm writing my program in Kotlin, so I had it translated by AndroidStudio, but the IDE cannot recognize this constant. Where do I find the declaration? The Kotlin adaptation of the function is below:

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) { val files = data?.getStringArrayListExtra("filePaths") for (file in files!!) { Log.e("tag",file) } } }

    Thanks a lot in advance!

    opened by bettinasmid 3
  • Should Add File Delete option

    Should Add File Delete option

    Actuall i am using it in my new app and i think you should add delete file feature also it will helpful for use to delete file without going to device file manger

    opened by Android1500 0
  • Using as part of existing view

    Using as part of existing view

    is it possible to move this into a View?

    For example, as an embedded file view in an app, similar to what PowerAmp does

    Eg

    FileManager fv = new FileManager(context);
    // set options for file manager
    fileManagerContainer.addView(fv);
    
    opened by mgood7123 3
  • SDK 30 file issue - not showing

    SDK 30 file issue - not showing

    Hi, I really love your design for this file picker. However, the project that I implemented with this library cannot find document-related file such as .pdf, .doc, .xlsx, .zip , etc.

    I am now using SDK 30, only image/video-related file displayed.
    Do you mind to help me to check it out?

    enhancement Android 11 
    opened by WenLonG12345 10
Releases(1.0.2)
  • 1.0.1(Jan 9, 2021)

    Release: v1.0.1

    Unicorn File Picker is a library designed to package a powerful file selector for Android. You can:

    • Start the file picker activity from any activity or fragment
    • Select single or multiple files
    • Use as a Directory Picker
    • Filter out files you want to display
    • Add a custom theme or use default theme options (Light & Dracula)
    Source code(tar.gz)
    Source code(zip)
Owner
Abhishek Tiwari
What can we build together?
Abhishek Tiwari
A super file picker framework.

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

null 7 Jul 16, 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
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
Wheel Picker With Kotlin

WheelPicker Including in your project Gradle Add below codes to your project build.gradle file. buildscript { repositories { mavenCentral(

Clapp Studio 8 Jan 16, 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
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
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
A smart colored time selector. Users can select just free time with a handy colorful range selector.

Colored Time Range Selector A smart colored time range selector. Users can select just free time with a handy colorful range selector. Screen Shots Fe

Ehsan Mehranvari 154 Oct 3, 2022
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

null 786 Jan 6, 2023
Android Country Picker is a Kotlin-first, flexible and powerful Android library that allows to integrate Country Picker with just a few lines.

1. Add dependency dependencies { implementation 'com.hbb20:android-country-picker:X.Y.Z' } For latest version, 2. Decide your use-case

Harsh B. Bhakta 65 Dec 6, 2022
A modified version of Android's experimental StaggeredGridView. Includes own OnItemClickListener and OnItemLongClickListener, selector, and fixed position restore.

StaggeredGridView Introduction This is a modified version of Android's experimental StaggeredGridView. The StaggeredGridView allows the user to create

Maurycy Wojtowicz 1.7k Nov 28, 2022
A simple time second selector seek bar custom made

A simple time second selector seek bar custom made How to To get a Git project into your build: Step 1. Add the JitPack repository to your build file

Mohammed Nadil 2 Nov 26, 2021
A program to flip every private, protected and package-private access flag to public in an Android dex file!

DexExposed A program to flip every private, protected and package-private access flag to public in an Android dex file! Building Simply run gradle mak

John Doe 2 Aug 29, 2021
A minimalist but powerful productivity timer designed to keep you focused and free of distractions.

Goodtime A minimalist but powerful productivity timer designed to keep you focused and free of distractions. Alternate between focused work sessions a

Adrian Cotfas 692 Dec 27, 2022
Picker-kt - Media picker library powered by Jetpack Compose

ANDROID LIBRARY PickerKT A media picker library for Android apps powered by Jetp

Tanawin Wichit 20 Jan 2, 2023
Pix is a Whatsapp image picker replica. with this, you can integrate an image picker just like WhatsApp.

Pix (WhatsApp Style Image and Video Picker) Pix is a WhatsApp image picker replica. with this you can integrate a image picker just like WhatsApp. Upc

Akshay sharma 742 Jan 4, 2023
Facebook-Styled-Image-Picker - Facebook Styled Image Picker

Facebook-Styled-Image-Picker Facebook Styled Gallery Files picker. One or multip

Hashim Tahir 11 Sep 27, 2022