All Projects → Angads25 → Android Filepicker

Angads25 / Android Filepicker

Licence: apache-2.0
Selecting directories/files made a lot easier.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Filepicker

Mmf
A modular framework for vision & language multimodal research from Facebook AI Research (FAIR)
Stars: ✭ 4,713 (+656.5%)
Mutual labels:  dialog
Search Dialog
An easy to use, yet very customizable search dialog
Stars: ✭ 503 (-19.26%)
Mutual labels:  dialog
Aosf
AOSF:全称为Android Open Source Framework,即Android优秀开源框架汇总。包含:网络请求okhttp,图片下载glide,数据库greenDAO,链式框架RxJava,组件路由ARouter,消息传递通信EventBus,热更新Tinker,插件化框架Replugin,文件下载FileDownloaer,图片选择PhotoPicker,图片滤镜/毛玻璃等特效处理,GIF图片展示控件,图片九宫格控件NineGridView,对话框Dialog,导航指示器ViewpagerIndicator,进度条ProgressWheel,下拉刷新SmartRefreshLayout,key-value高效数据存储MMKV等,应有尽有。
Stars: ✭ 601 (-3.53%)
Mutual labels:  dialog
React Cool Portal
😎 🍒 React hook for Portals, which renders modals, dropdowns, tooltips etc. to <body> or else.
Stars: ✭ 458 (-26.48%)
Mutual labels:  dialog
Happybubble
💭BubbleLayout随意变化的气泡布局、消息对话框,可定制颜色,背景、弧度、尖角弧度、边框等等。BubbleDialog气泡弹窗根据点击View的位置定位它的弹窗位置,BubbleDialog可定制方向等!(BubbleLayout changes freely,BubbleDialog click on the location of View positioning its location,BubbleDialog can be customized directions.)
Stars: ✭ 487 (-21.83%)
Mutual labels:  dialog
Giffy dialog
A Flutter package for a quick and handy giffy dialog.
Stars: ✭ 517 (-17.01%)
Mutual labels:  dialog
Gijgo
Gijgo - Free Javascript Controls
Stars: ✭ 424 (-31.94%)
Mutual labels:  dialog
Rmodal.js
A simple 1.2 KB modal dialog with no dependencies
Stars: ✭ 613 (-1.61%)
Mutual labels:  dialog
Xtoast
Android 悬浮窗框架,好用不解释
Stars: ✭ 493 (-20.87%)
Mutual labels:  dialog
Sweetalert
A beautiful replacement for JavaScript's "alert"
Stars: ✭ 21,871 (+3410.59%)
Mutual labels:  dialog
Seq2seqchatbots
A wrapper around tensor2tensor to flexibly train, interact, and generate data for neural chatbots.
Stars: ✭ 466 (-25.2%)
Mutual labels:  dialog
Indicatordialog
a dialog with arrow indicator in the location where you want
Stars: ✭ 485 (-22.15%)
Mutual labels:  dialog
Ngx Ui
🚀 Style and Component Library for Angular
Stars: ✭ 534 (-14.29%)
Mutual labels:  dialog
Sppermissions
Ask permissions with ready-use interface. You can check status permission and if it has been requested before. Support SwiftUI.
Stars: ✭ 4,701 (+654.57%)
Mutual labels:  dialog
Materialdialog Android
📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.
Stars: ✭ 602 (-3.37%)
Mutual labels:  dialog
Smart Show
Toast & Snackbar & TopBar & Dialog
Stars: ✭ 430 (-30.98%)
Mutual labels:  dialog
Ngx Sweetalert2
Declarative, reactive, and template-driven SweetAlert2 integration for Angular
Stars: ✭ 503 (-19.26%)
Mutual labels:  dialog
Android Simple Tooltip
A simple library based on PopupWindow to create Tooltips on Android. 💚
Stars: ✭ 622 (-0.16%)
Mutual labels:  dialog
Smart App Rate
An Android library that encourages users to rate the app on the Google Play.
Stars: ✭ 609 (-2.25%)
Mutual labels:  dialog
Dialogplus
Advanced dialog solution for android
Stars: ✭ 4,936 (+692.3%)
Mutual labels:  dialog

The project is no longer being maintained.

FilePicker

Super Lite Android Library to select files/directories from Device Storage.

Developed by

Angad Singh (@angads25)

Benchmark:

API

Where to Find:

Download Maven Central Android Arsenal

Read all about internal classes and functions in the wiki.

Features

  • Easy to Implement.
  • No permissions required.
  • Files, Directory Selection.
  • Single or Multiple File selection.

Installation

  • Library is also Available in MavenCentral, So just put this in your app dependencies to use it:
    compile 'com.github.angads25:filepicker:1.1.1'

Usage

FilePickerDialog

  1. Start by creating an instance of DialogProperties.

        DialogProperties properties = new DialogProperties();
    

    Now 'DialogProperties' has certain parameters.

  2. Assign values to each Dialog Property using DialogConfig class.

        properties.selection_mode = DialogConfigs.SINGLE_MODE;
        properties.selection_type = DialogConfigs.FILE_SELECT;
        properties.root = new File(DialogConfigs.DEFAULT_DIR);
        properties.error_dir = new File(DialogConfigs.DEFAULT_DIR);
        properties.offset = new File(DialogConfigs.DEFAULT_DIR);
        properties.extensions = null;
    
  3. Next create an instance of FilePickerDialog, and pass Context and DialogProperties references as parameters. Optional: You can change the title of dialog. Default is current directory name. Set the positive button string. Default is Select. Set the negative button string. Defalut is Cancel.

        FilePickerDialog dialog = new FilePickerDialog(MainActivity.this,properties);
        dialog.setTitle("Select a File");
    
  4. Next, Attach DialogSelectionListener to FilePickerDialog as below,

        dialog.setDialogSelectionListener(new DialogSelectionListener() {
            @Override
            public void onSelectedFilePaths(String[] files) {
                //files is the array of the paths of files selected by the Application User.
            }
        });
    

    An array of paths is returned whenever user press the select button`.

  5. Use dialog.show() method to show dialog.

NOTE:

Marshmallow and above requests for the permission on runtime. You should override onRequestPermissionsResult in Activity/AppCompatActivity class and show the dialog only if permissions have been granted.

        //Add this method to show Dialog when the required permission has been granted to the app.
        @Override
        public void onRequestPermissionsResult(int requestCode,@NonNull String permissions[],@NonNull int[] grantResults) {
            switch (requestCode) {
                case FilePickerDialog.EXTERNAL_READ_PERMISSION_GRANT: {
                    if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                        if(dialog!=null)
                        {   //Show dialog if the read permission has been granted.
                            dialog.show();
                        }
                    }
                    else {
                        //Permission has not been granted. Notify the user.
                        Toast.makeText(MainActivity.this,"Permission is Required for getting list of files",Toast.LENGTH_SHORT).show();
                    }
                }
            }
        }
That's It. You are good to proceed further.

FilePickerPreference

  1. Start by declaring FilePickerPreference in your settings xml file as:

       <com.github.angads25.filepicker.view.FilePickerPreference
           xmlns:app="http://schemas.android.com/apk/res-auto"
           android:key="your_preference_key"
           android:title="Pick a Directory"
           android:summary="Just a Summary"
           android:defaultValue="/sdcard:/mnt"
           app:titleText="Select Directories"
           app:error_dir="/mnt"
           app:root_dir="/sdcard"
           app:selection_mode="multi_mode"
           app:selection_type="dir_select"
           app:extensions="txt:pdf:"/>
    
  2. Implement Preference.OnPreferenceChangeListener to class requiring selected values and Override onPreferenceChange(Preference, Object) method. Check for preference key using Preference reference.

        @Override
        public boolean onPreferenceChange(Preference preference, Object o)
        {   if(preference.getKey().equals("your_preference_key"))
            {   ...
            }
            return false;
        }
    
  3. Typecast Object o into String Object and use split(String) function in String class to get array of selected files.

        @Override
        public boolean onPreferenceChange(Preference preference, Object o)
        {   if(preference.getKey().equals("your_preference_key"))
            {   String value=(String)o;
                String arr[]=value.split(":");
                ...
                ...
            }
            return false;
        }
    

    That's It. You are good to move further.

Important:

  • defaultValue, error_dir, root_dir, offset_dir must have valid directory/file paths.
  • defaultValue paths should end with ':'.
  • defaultValue can have multiple paths, there should be a ':' between two paths.
  • extensions must not have '.'.
  • extensions should end with ':' , also have ':' between two extensions. eg. /sdcard:/mnt:

Note:

FilePickerPreference stores selected directories/files as a String. It delimits multiple files/directories using ':' char.

Read more on implementation here.

Screenshot

Theme.Black

Screenshot 1

Theme.Holo

Screenshot 2

Theme.Holo.Light

Screenshot 3

Theme.Material

Screenshot 4

Theme.DeviceDefault

Screenshot 5

Performance

GPU Overdraw

Performance 1

GPU Rendering

Performance 2

License

Copyright (C) 2016 Angad Singh

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].