All Projects → adityak368 → Android Filebrowser Filepicker

adityak368 / Android Filebrowser Filepicker

Licence: mit
A FileBrowser / FileChooser / FolderChooser for Android that you can integrate to your app to browse/select files from internal/external storage

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Filebrowser Filepicker

Filesystem
FileSystem is an application that allows you to browse the content of your iPhone disk, displaying file and folders, files contents, and detailed informations about file and folder permissions.
Stars: ✭ 148 (-5.73%)
Mutual labels:  filesystem, browser
Filer
Node-like file system for browsers
Stars: ✭ 389 (+147.77%)
Mutual labels:  filesystem, browser
Browser Shell
A Linux command-line shell in the browser
Stars: ✭ 60 (-61.78%)
Mutual labels:  filesystem, browser
Nohost
A web server in your web browser
Stars: ✭ 164 (+4.46%)
Mutual labels:  filesystem, browser
Simple Fs
Handles files on indexeddb like you would do in node.js (promise)
Stars: ✭ 111 (-29.3%)
Mutual labels:  filesystem, browser
Europa
Pure JavaScript library for converting HTML into valid Markdown
Stars: ✭ 143 (-8.92%)
Mutual labels:  browser
Libarchivejs
Archive library for browsers
Stars: ✭ 145 (-7.64%)
Mutual labels:  browser
Focus Android
Firefox Focus: The privacy browser - Browse like no one’s watching.
Stars: ✭ 1,901 (+1110.83%)
Mutual labels:  browser
Obsolete Webpack Plugin
🌈 A Webpack plugin generates a browser-side standalone script that detects browser compatibility based on `Browserslist` and prompts website users to upgrade it.
Stars: ✭ 148 (-5.73%)
Mutual labels:  browser
Node Proper Lockfile
An inter-process and inter-machine lockfile utility that works on a local or network file system.
Stars: ✭ 139 (-11.46%)
Mutual labels:  filesystem
Lazy
Kule Lazy4 / CSS Framework
Stars: ✭ 147 (-6.37%)
Mutual labels:  browser
Dropbox Filesystem Fix
Fix the filesystem detection in the Linux Dropbox client
Stars: ✭ 144 (-8.28%)
Mutual labels:  filesystem
Kcli
A kafka command line browser
Stars: ✭ 148 (-5.73%)
Mutual labels:  browser
Gocryptfs
Encrypted overlay filesystem written in Go
Stars: ✭ 2,088 (+1229.94%)
Mutual labels:  filesystem
Cast Sh
📟 An instance of your terminal in your browser
Stars: ✭ 151 (-3.82%)
Mutual labels:  browser
Onfido Sdk Ui
The Onfido SDK for Front-end JavaScript
Stars: ✭ 139 (-11.46%)
Mutual labels:  browser
React Border Wrapper
A wrapper for placing elements along div borders.
Stars: ✭ 147 (-6.37%)
Mutual labels:  browser
Link Fix
我的浏览器 UserScript 脚本仓库,这里是数个独立的 UserScript 浏览器脚本,为浏览器实现了各种强大的的功能。我的 greasyfork 主页:
Stars: ✭ 150 (-4.46%)
Mutual labels:  browser
Mc
MinIO Client is a replacement for ls, cp, mkdir, diff and rsync commands for filesystems and object storage.
Stars: ✭ 1,962 (+1149.68%)
Mutual labels:  filesystem
Uppie
Cross-browser directory and multi-file upload library
Stars: ✭ 144 (-8.28%)
Mutual labels:  browser

FileBrowser

A FileBrowser / FileChooser for Android that you can integrate to your app to browse/select files from internal/external storage.

Android Arsenal

Using Maven

<dependency>
  <groupId>com.adityak</groupId>
  <artifactId>browsemyfiles</artifactId>
  <version>1.9</version>
  <type>pom</type>
</dependency>

Or Using Gradle

compile 'com.adityak:browsemyfiles:1.9'

It easily integrates with your app's color scheme. You can change the color scheme using the following in your styles.xml

<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:actionModeBackground">@color/actionModeToolbar</item>

There are 3 main classes to use the library.

  1. FileBrowser - Used to just Browse files in storage (has all file IO features)
  2. FileChooser - Used to select single/multiple files in storage (has some IO features)
  3. FolderChooser - Used to select single/multiple folders in storage (has some IO features)
  4. FileBrowserWithCustomHandler - Used to run custom code when files are selected (has all IO features)

1. FileBrowser

Use following Intent to start the FileBrowser

Intent i4 = new Intent(getApplicationContext(), FileBrowser.class);
startActivity(i4);

2. FileChooser

Use following Intent to start the FileChooser

  • For Single Selection
Intent i2 = new Intent(getApplicationContext(), FileChooser.class);
i2.putExtra(Constants.SELECTION_MODE, Constants.SELECTION_MODES.SINGLE_SELECTION.ordinal());
startActivityForResult(i2, PICK_FILE_REQUEST);

To get the selected file, In your calling activity's onActivityResult method, use the following

if (requestCode == PICK_FILE_REQUEST && data!=null) {
      if (resultCode == RESULT_OK) {
          Uri file = data.getData();
      }
}
        
  • For Multiple Selection
Intent i2 = new Intent(getApplicationContext(), FileChooser.class);
i2.putExtra(Constants.SELECTION_MODE, Constants.SELECTION_MODES.MULTIPLE_SELECTION.ordinal());
startActivityForResult(i2, PICK_FILE_REQUEST);

To get the selected file, In your calling activity's onActivityResult method, use the following

if (requestCode == PICK_FILE_REQUEST && data!=null) {
      if (resultCode == RESULT_OK) {
          ArrayList<Uri> selectedFiles  = data.getParcelableArrayListExtra(Constants.SELECTED_ITEMS);
      }
}
        

3. FolderChooser

Use following Intent to start the FolderChooser

  • For Single Selection
Intent i2 = new Intent(getApplicationContext(), FolderChooser.class);
i2.putExtra(Constants.SELECTION_MODE, Constants.SELECTION_MODES.SINGLE_SELECTION.ordinal());
startActivityForResult(i2, PICK_FOLDER_REQUEST);

To get the selected folder, In your calling activity's onActivityResult method, use the following

if (requestCode == PICK_FOLDER_REQUEST && data!=null) {
      if (resultCode == RESULT_OK) {
          Uri file = data.getData();
      }
}
        
  • For Multiple Selection
Intent i2 = new Intent(getApplicationContext(), FolderChooser.class);
i2.putExtra(Constants.SELECTION_MODE, Constants.SELECTION_MODES.MULTIPLE_SELECTION.ordinal());
startActivityForResult(i2, PICK_FOLDER_REQUEST);

To get the selected file, In your calling activity's onActivityResult method, use the following

if (requestCode == PICK_FOLDER_REQUEST && data!=null) {
      if (resultCode == RESULT_OK) {
          ArrayList<Uri> selectedFiles  = data.getParcelableArrayListExtra(Constants.SELECTED_ITEMS);
      }
}
        

4. FileBrowserWithCustomHandler

Register a Broadcast receiver and handle the onReceive method like below

public class FileSelectedBroadCastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
         Uri filePath = intent.getParcelableExtra(com.aditya.filebrowser.Constants.BROADCAST_SELECTED_FILE);
    }
}

Register the receiver like the following snippet

        <receiver android:name=".FileSelectedBroadCastReceiver"
            android:exported="false"
            android:enabled="true">
            <intent-filter>
                <action android:name="com.adityak.filebrowser.FILE_SELECTED_BROADCAST" />
            </intent-filter>
        </receiver>
        

If you also need some other parameters to be sent with the broadcast use the following when creating the activity

Intent i = new Intent(mContext, FileBrowserWithCustomHandler.class);
Bundle ib = new Bundle();
//add extras
i.putExtras(ib);
startActivity(i);

and in the broadcast receiver use the following to get the extras

Bundle b = intent.getExtras()

To load a particular directory instead of the normal root directory

Add the following in the intent

Intent i = new Intent(this, FileBrowser.class); //works for all 3 main classes (i.e FileBrowser, FileChooser, FileBrowserWithCustomHandler)
i.putExtra(Constants.INITIAL_DIRECTORY, new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"Movies").getAbsolutePath());

To list only the files with a particular extension

Add the following in the intent

Intent i = new Intent(this, FileBrowser.class); //works for all 3 main classes (i.e FileBrowser, FileChooser, FileBrowserWithCustomHandler)
i.putExtra(Constants.ALLOWED_FILE_EXTENSIONS, "mkv;mp4;avi");

Use file extensions delimited by semicolon

Known Issues

Currently folder size is calculated using Java's Api getTotalSpace() which gives the size of the partition of the path which may not always give the desired result. To get the exact size, properties can be used which gives the exact result. If Exact size is to be known, then UI would lag as it would take some time to calculate size - Fix for this is postponed

If you have any questions/queries/Bugs/Hugs please mail @ [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].