Giter Club home page Giter Club logo

exfilepicker's Introduction

ExFilePicker

ExFilePicker is an open source android library that allows developers to easily implement choosing files and directories in application.

Screenshotes:

Screenshot Screenshot Screenshot

Features

It can:

  • Choose one file
  • Choose one directory
  • Choose few files and/or directories
  • Filter by file extension
  • Sorting
  • Creating directories

Download

AAR: ExFilePicker.aar

Usage

1. Add ExFilePicker library as a dependency to your project

2. Add next code into your project where is needed:

import ru.bartwell.exfilepicker.ExFilePicker;
import ru.bartwell.exfilepicker.ExFilePickerParcelObject;

// ...
	
	private static final int EX_FILE_PICKER_RESULT = 0;

	// ...
	
		Intent intent = new Intent(getApplicationContext(), ru.bartwell.exfilepicker.ExFilePickerActivity.class);
		startActivityForResult(intent, EX_FILE_PICKER_RESULT);

	// ...
	
	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (requestCode == EX_FILE_PICKER_RESULT) {
			if (data != null) {
				ExFilePickerParcelObject object = (ExFilePickerParcelObject) data.getParcelableExtra(ExFilePickerParcelObject.class.getCanonicalName());
				if (object.count > 0) {
					// Here is object contains selected files names and path
				}
			}
		}
	}

3. Add activity in your Manifest:

	<activity
		android:name="ru.bartwell.exfilepicker.ExFilePickerActivity"
		android:configChanges="orientation|screenSize"
		android:theme="@style/ExFilePickerThemeDark" />

4. If you need a "New folder" button, add permission in your Manifest:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Configuration

ExFilePicker can be configurated via intent extras.

  • SET_ONLY_ONE_ITEM - boolean; if true, user can select only one item. False by default.

  • SET_FILTER_BY_EXTENSION - removed. Use SET_FILTER_EXCLUDE or SET_FILTER_LISTED instead.

  • SET_FILTER_LISTED - String[]; only files with this extensions will showed.

  • SET_FILTER_EXCLUDE - String[]; files with this extensions will excluded.

  • SET_CHOICE_TYPE - int; one of CHOICE_TYPE_ALL, CHOICE_TYPE_FILES or CHOICE_TYPE_DIRECTORIES. Set what user can select - only files, only directories or both. Both by default.

  • SET_START_DIRECTORY - String. This path will be open when ExFilePicker activity will called.

  • DISABLE_NEW_FOLDER_BUTTON - boolean; if true, button "New folder" will not showing.

  • DISABLE_SORT_BUTTON - boolean; if true, button "Sort" will not showing.

  • ENABLE_QUIT_BUTTON - boolean; if true, quit button will showing.

  • SET_SORT_TYPE - int; one of SORT_NAME_ASC, SORT_NAME_DESC, SORT_SIZE_ASC, SORT_SIZE_DESC, SORT_DATE_ASC or SORT_DATE_DESC. Set default sorting. SORT_NAME_ASC by default.

Look example in ExFilePickerSample.

Customization

ExFilePicker library provide two themes for ExFilePicker's activity: dark and light (ExFilePickerThemeDark and ExFilePickerThemeLight respectively). If you need to customize ExFilePicker's activity view, you can extend your own theme from any ExFilePicker's theme and override needed options.

Sample Application

Get it on Google Play

License

The MIT License (MIT)

Copyright (c) 2013 Artem Bazhanov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

exfilepicker's People

Contributors

bartwell avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.