FilePickerLibrary


Source link: https://github.com/DeveloperPaul123/FilePickerLibrary

FilePickerLibrary

Simple library that allows for picking of files and directories. This is a clean and simple way to allow your user to easily select a file. This library is inspired by Android L and the new Material Design guidelines adding to its sleekness and beauty.

![image] (images/main_framed.png)

A Quick Overview What's In

  • Compatible down to API Level 16

Include to Project

Provide the Gradle Dependency

Step 1

Add the JitPack in your root build.gradle at the end of repositories:

allprojects {

  repositories {

...

maven {
 url "https://jitpack.io" 
}

  
}
 
}

Step 2

Add the dependency

dependencies {

  compile 'com.github.alirezaaa:FilePickerLibrary:3.5.1' 
}

Clone or Download .zip file

Clone this repository or download the compressed file, then extract to your computer. Simply import the library module to your project.

Usages

Use one of the following samples or simply compile and test the sample app provided:

Material Theme Used (with Modern Builder)

new FilePickerBuilder(this)
  .withColor(android.R.color.holo_blue_bright)
  .withRequest(Request.FILE)
  .withScope(Scope.ALL)
  .withMimeType(MimeType.JPEG)
  .useMaterialActivity(true)
  .launch(REQUEST_FILE);

image/png Mime Type

Intent filePicker = new Intent(this, FilePickerActivity.class);
 filePicker.putExtra(FilePickerActivity.SCOPE, Scope.ALL);
 filePicker.putExtra(FilePickerActivity.REQUEST, Request.FILE);
 filePicker.putExtra(FilePickerActivity.INTENT_EXTRA_COLOR_ID, android.R.color.holo_green_dark);
 filePicker.putExtra(FilePickerActivity.MIME_TYPE, MimeType.PNG);
 startActivityForResult(filePicker, REQUEST_FILE);

Show as a Dialog

Intent filePickerDialogIntent = new Intent(this, FilePickerActivity.class);
 filePickerDialogIntent.putExtra(FilePickerActivity.THEME_TYPE, ThemeType.DIALOG);
 filePickerDialogIntent.putExtra(FilePickerActivity.REQUEST, Request.FILE);
 startActivityForResult(filePickerDialogIntent, REQUEST_FILE);

Select a Directory

Intent filePickerActivity = new Intent(this, FilePickerActivity.class);
 filePickerActivity.putExtra(FilePickerActivity.SCOPE, Scope.ALL);
 filePickerActivity.putExtra(FilePickerActivity.REQUEST, Request.DIRECTORY);
 filePickerActivity.putExtra(FilePickerActivity.INTENT_EXTRA_FAB_COLOR_ID, android.R.color.holo_green_dark);
 startActivityForResult(filePickerActivity, REQUEST_DIRECTORY);

To have the result, you must override onActivityResult(int, int, Intent) method as I did below:

@Override public void onActivityResult(int requestCode, int resultCode, Intent data) {

  super.onActivityResult(requestCode, resultCode, data);

if ((requestCode == REQUEST_DIRECTORY) && (resultCode == RESULT_OK)) {

Toast.makeText(this, "Directory Selected: " + data.getStringExtra(FilePickerActivity.FILE_EXTRA_DATA_PATH), Toast.LENGTH_LONG).show();

  
}
 else if ((requestCode == REQUEST_FILE) && (resultCode == RESULT_OK)) {

Toast.makeText(this, "File Selected: " + data.getStringExtra(FilePickerActivity.FILE_EXTRA_DATA_PATH), Toast.LENGTH_LONG).show();

  
}
 
}

Contributors

License

Copyright 2016 Paul T  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

PinCodePicker was created for Android platform as a view which allows to take passwords/codes or some other sensitive data from end user in easy way, so developers can focus on the core functionalities of their application.

Android View that displays different content based on its state (Content, Empty, Error, Loading).

The easiest way to create adapters! You can add a lot of different layouts and models. This library avoid all the boilerplates needed to create a list for your application.

Highly inspired on Renderers and RecyclerViewRenderers.

SquiDB is a SQLite database layer for Android. It is designed to make it as easy as possible to work with SQLite databases while still enabling the power and flexibility of raw SQL. SquiDB combines features of an ORM with object-oriented SQL statement builders to make it easy to read and write your data without a bunch of messy SQL strings. It also includes built in tools and hooks to help you easily write database migrations as well as implement ContentProviders.

Fast & simple benchmarking framework for Android. Ever had the feeling that certain parts of your code were slow? Now you can prove it (and make sure your refactor worked).

Pretty material design toasts with feedback animations.

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