Code Monkey home page Code Monkey logo

android-file-chooser's Introduction

Android-File-Chooser

This is a fork of the android-file-dialog https://code.google.com/p/android-file-dialog/ by alexander.ponomarev.

Intentprocessing and file listing were changed as well as the layout (little improvements).

##Intent flags There are several fields that may be specified for the Intent calling the Activity:

###START_PATH The directory the FileDialog should point to initially.

FORMAT_FILTER

FileFilter(s)

OPERATION_MODE

The mode of operation :), either MODE_CREATE to "save" files or MODE_OPEN to open/select files

SELECT_MODE

Specifies the elements to be selectable by the user, this is a bitmask with may be constructed from SELECT_FOLDER and SELECT_FILE

VIEW_MODE

Almost the same as SELECT_MODE, but will only affect the "viewable" (displayed) elements [files and/or folders] (viewMode can also be changed by FORMAT_FILTER)

BROWSE_ENABLED

Allow user to browse inside the "START_PATH" (true by default)

FILE_DRAWABLE

Bitmap for file icon.

FOLDER_DRAWABLE

Bitmap for folder icon.

##example:

Intent intent = new Intent(getBaseContext(),FileChooserDialog.class);
intent.putExtra(FileChooserDialog.START_PATH, Environment.getExternalStorageDirectory().getAbsolutePath());
intent.putExtra(FileChooserDialog.SELECT_MODE, FileChooserDialog.MODE_OPEN);

//can user select directories or not
intent.putExtra(FileChooserDialog.VIEW_MODE, FileChooserDialog.SELECT_FILE);
intent.putExtra(FileChooserDialog.FILE_DRAWABLE, BitmapFactory.decodeResource(getResources(),R.drawable.fontfile));
intent.putExtra(FileChooserDialog.FOLDER_DRAWABLE, BitmapFactory.decodeResource(getResources(),R.drawable.folder));
intent.putExtra(FileChooserDialog.UP_DRAWABLE, BitmapFactory.decodeResource(getResources(),R.drawable.folderup));
                             
FileChooserFileFilter[] cf = new FileChooserFileFilter[]{new SuffixFileFilter(new String[]{"ttf"}),new FolderFileFilter()}; 
intent.putExtra(FileChooserDialog.FORMAT_FILTER,new CombinedFileFilter(cf,CombinedCheck.OR));

startActivityForResult(intent,CHOOSE_FONT);

This lib is licensed under The LGPL.

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.