Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

jfmdev/aFileDialog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been archived due to newer versions of Android providing native support for these features.

aFileDialog

aFileDialog is an Android library which implements a simple and easy to use file chooser.

His main features are:

  • The file chooser can be opened both as a Dialog or as an Activity.
  • You can filter the files and folders using regular expressions.
  • Can select files or folders.
  • Can create files and folders.

How to use it

In order to use aFileDialog in your application you must do three steps:

1) Add a reference to the library project (which is located in the library folder). Note that, since aFileDialog is a Android Library project, it can not be compiled into a binary file (such as a JAR file), so your project must reference to the aFileDialog project, instead of reference to a single JAR file.

2) Declare the activity FileChooserActivity in the manifest file. This can be done by adding the following lines inside the tags <application></application>:

    <activity android:name="ar.com.daidalos.afiledialog.FileChooserActivity" />

3) Add the permission READ_EXTERNAL_STORAGE to the manifest file, if you want to access the SD card (and if you are using Android 4.1 or superior).

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

4) On Android 6.0 and higher, besides listing the permission on the manifest file, you must also request users to approve the permission at runtime. For example:

if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
    // If permission is not granted, ask it.
    ActivityCompat.requestPermissions(this,
            new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
            MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
}

Check https://developer.android.com/training/permissions/requesting for more information.

5) Then you must only create an instance of FileChooserDialog and call the show() method:

    FileChooserDialog dialog = new FileChooserDialog(context);
    dialog.show();

Or start the activity FileChooserActivity:

    Intent intent = new Intent(this, FileChooserActivity.class);
    this.startActivityForResult(intent, 0);

Note: the current version of the library is developed using Android Studio, if you are using Eclipse, then you should check the eclipse branch.

Demo

In the demo folder who will find the project of a sample app that makes uses of aFileDialog.

You can also install this demo app from Google Play.

Documentation

aFileDialog has been designed in order to be easy to use and easy to develop.

In order to known how to use aFileDialog, check the user guide (also available in Spanish and French).

If you want to modify or extend aFileDialog, you can read the software design description (also available in Spanish), although this is not mandatory, since the code is fully commented and you are going to figure out how it works in matters of minutes.

License

This library is free software; you can redistribute it and/or modify it under the terms of the Mozilla Public License v2.0. You should have received a copy of the MPL 2.0 along with this library, otherwise you can obtain one at http://mozilla.org/MPL/2.0/.

About

Android library which provides a simple file chooser

Resources

License

Stars

Watchers

Forks

Packages

No packages published