{"id":13591338,"url":"https://github.com/iPaulPro/aFileChooser","last_synced_at":"2025-04-08T14:33:22.087Z","repository":{"id":2056817,"uuid":"2994936","full_name":"iPaulPro/aFileChooser","owner":"iPaulPro","description":"[DEPRECATED] Android library that provides a file explorer to let users select files on external storage.","archived":true,"fork":false,"pushed_at":"2022-08-28T17:13:25.000Z","size":5386,"stargazers_count":1784,"open_issues_count":70,"forks_count":847,"subscribers_count":115,"default_branch":"master","last_synced_at":"2025-01-17T20:37:49.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"inssein/jsfx","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iPaulPro.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-IANLAKE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-16T13:56:07.000Z","updated_at":"2025-01-03T01:29:24.000Z","dependencies_parsed_at":"2022-09-03T14:10:11.137Z","dependency_job_id":null,"html_url":"https://github.com/iPaulPro/aFileChooser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iPaulPro%2FaFileChooser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iPaulPro%2FaFileChooser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iPaulPro%2FaFileChooser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iPaulPro%2FaFileChooser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iPaulPro","download_url":"https://codeload.github.com/iPaulPro/aFileChooser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247861187,"owners_count":21008443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:00:56.322Z","updated_at":"2025-04-08T14:33:17.078Z","avatar_url":"https://github.com/iPaulPro.png","language":"Java","funding_links":[],"categories":["Java","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"# aFileChooser - Android File Chooser\n\naFileChooser is an __Android Library Project__ that simplifies the process of presenting a file chooser on Android 2.1+.\n\nIntents provide the ability to hook into third-party app components for content selection. This works well for media files, but if you want users to be able to select *any* file, they must have an existing \"file explorer\" app installed. Because many Android devices don't have stock File Explorers, the developer must often instruct the user to install one, or build one, themselves. aFileChooser solves this issue.\n\n### Features:\n\n * Full file explorer\n * Simplify `GET_CONTENT` Intent creation\n * Hooks into Storage Access Framework\n * Determine MIME data types\n * Follows Android conventions (Fragments, Loaders, Intents, etc.)\n * Supports API 7+\n\n![screenshot-1](https://raw.github.com/iPaulPro/aFileChooser/master/screenshot-1.png) ![screenshot-2](https://raw.github.com/iPaulPro/aFileChooser/master/screenshot-2.png)\n\n## Setup\n\nAdd aFileChooser to your project as an [Android Library Project](http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject).\n\nAdd `FileChooserActivity` to your project's AndroidManifest.xml file with a fully-qualified `name`. The `label` and `icon` set here will be shown in the \"Intent Chooser\" dialog.\n\n__Important__ `FileChooserActivity` must have `android:exported=\"true\"` and have the `\u003cintent-filter\u003e` set as follows:\n\n    \u003cactivity\n        android:name=\"com.ipaulpro.afilechooser.FileChooserActivity\"\n        android:icon=\"@drawable/ic_chooser\"\n\t\tandroid:enabled=\"@bool/use_activity\"\n        android:exported=\"true\"\n        android:label=\"@string/choose_file\" \u003e\n        \u003cintent-filter\u003e\n            \u003caction android:name=\"android.intent.action.GET_CONTENT\" /\u003e\n\n            \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n            \u003ccategory android:name=\"android.intent.category.OPENABLE\" /\u003e\n\n            \u003cdata android:mimeType=\"*/*\" /\u003e\n        \u003c/intent-filter\u003e\n    \u003c/activity\u003e\n\nIf you want to use the Storage Access Framework (API 19+), include [Ian Lake](https://github.com/ianhanniballake/)'s `LocalStorageProvider` (included in this library) in your `\u003capplication\u003e`:\n\n\t\u003cprovider\n        android:name=\"com.ianhanniballake.localstorage.LocalStorageProvider\"\n        android:authorities=\"com.ianhanniballake.localstorage.documents\"\n\t\tandroid:enabled=\"@bool/use_provider\"\n        android:exported=\"true\"\n        android:grantUriPermissions=\"true\"\n        android:permission=\"android.permission.MANAGE_DOCUMENTS\" \u003e\n            \u003cintent-filter\u003e\n                \u003caction android:name=\"android.content.action.DOCUMENTS_PROVIDER\" /\u003e\n            \u003c/intent-filter\u003e\n    \u003c/provider\u003e\n\n__Note__ that like a `ContentProvider`, the `DocumentProvider` `authority` must be unique. You should change `com.ianhanniballake.localstorage.documents` in your Manifest, as well as the `LocalStorageProvider.AUTHORITY` field.\n\nUsing `FileChooserActivity` and `LocalStorageProvider` together are redundant if you're only trying to insure your user has access to local storage. If this is the case, you should enable/disable based on the API level (above: `@bool/use_provider` and `@bool/use_activity`). See the aFileChooserExample project for their values.\n\n## Usage\n\nUse `startActivityForResult(Intent, int)` to launch `FileChooserActivity` directly. `FileChooserActivity` returns the `Uri` of the file selected as the `Intent` data in `onActivityResult(int, int, Intent)`. Alternatively, you can use the helper method `FileUtils.createGetContentIntent()` to construct an `ACTION_GET_CONTENT` Intent that will show an \"Intent Chooser\" dialog on pre Kit-Kat devices, and the \"Documents UI\" otherwise. E.g.:\n\n    private static final int REQUEST_CHOOSER = 1234;\n\n    @Override\n    public void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        // Create the ACTION_GET_CONTENT Intent\n        Intent getContentIntent = FileUtils.createGetContentIntent();\n\t\t\n        Intent intent = Intent.createChooser(getContentIntent, \"Select a file\");\n        startActivityForResult(intent, REQUEST_CHOOSER);\n    }\n\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        switch (requestCode) {\n        \tcase REQUEST_CHOOSER:\t\n            \tif (resultCode == RESULT_OK) {\n\t\t\t\t\t\n                \tfinal Uri uri = data.getData();\n\t\t\t\t\t\n\t\t\t\t\t// Get the File path from the Uri\n                \tString path = FileUtils.getPath(this, uri);\n\t\t\t\t\t\n\t\t\t\t\t// Alternatively, use FileUtils.getFile(Context, Uri)\n\t\t\t\t\tif (path != null \u0026\u0026 FileUtils.isLocal(path)) {\n\t\t\t\t\t\tFile file = new File(path);\n\t\t\t\t\t}\n            \t}\n\t\t\t\tbreak;\n        }\n    }\n\nA more robust example can be found in the aFileChooserExample project.\n\n__Note__ the `FileUtils` method to get a file path from a `Uri` (`FileUtils.getPath(Context, Uri)`). This works for `File`, `MediaStore`, and `DocumentProvider` `Uris`.\n\n## Credits\n\nDeveloped by Paul Burke (iPaulPro) - [paulburke.co](http://paulburke.co/)\n\nTranslations by [TomTasche](https://github.com/TomTasche), [booknara](https://github.com/booknara), [brenouchoa](https://github.com/brenouchoa)\n\nFolder by [Sergio Calcara](http://thenounproject.com/fallacyaccount) from The Noun Project (ic_provider.png)\n\nDocument by [Melvin Salas](http://thenounproject.com/msalas10) from The Noun Project (ic_file.png)\n\n## Licenses\n\n    Copyright (C) 2011 - 2013 Paul Burke\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\nPortions of FileUtils.java:\n\n    Copyright (C) 2007-2008 OpenIntents.org\n \n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\nLocalStorageProvider.java:\n\n\tCopyright (c) 2013, Ian Lake\n\tAll rights reserved.\n\n\tRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n\t- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\t- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\t- Neither the name of the \u003cORGANIZATION\u003e nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\n\tTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\t","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FiPaulPro%2FaFileChooser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FiPaulPro%2FaFileChooser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FiPaulPro%2FaFileChooser/lists"}