FileListerDialog
FileListerDialog helps you to list and pick file/directory. Library is built for Android
Getting Started
Installing
To use this library simply import it by placing the following line under dependencies in your app module's build.gradle file
This library is posted in jCenter
dependencies {
implementation 'yogesh.firzen:FilesLister:1.0.1.g'
}
If any problem occured while importing please add this line to your app module's build. gradle file
repositories {
maven {url "https://dl.bintray.com/firzenyogesh/maven"}
}
This library has dependencies
dependencies {
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support:design:26.0.0'
implementation 'com.android.support:recyclerview-v7:26.0.0'
implementation 'yogesh.firzen:MukkiyaSevaigal:1.0.6'
}
Usage
After importing the library you can use FileListerDialog to list the files and pick one among them. Simply follow the steps
-
Create an instance of FileListerDialog by using the static method createFileListerDialog()
Default Instance:
FileListerDialog fileListerDialog = FileListerDialog.createFileListerDialog(context);
Instance with a theme for Dialog:
FileListerDialog fileListerDialog = FileListerDialog.createFileListerDialog(context, themeId);
-
Set OnFileSelectedListener so that you get what file/ directory has been selected
filelister.setOnFileSelectedListener(new OnFileSelectedListener() { @Override public void onFileSelected(File file, String path) { //your code here } });
-
Set the default directory to load when showing the dialog:
Using a file
fileListerDialog.setDefaultDir(file);
Using a file path
fileListerDialog.setDefaultDir(path);
-
Set the File Filter type to filter the type of files to be listed:
fileListerDialog.setFileFilter(FileListerDialog.FILE_FILTER.ALL_FILES);
Possible values are:
FileListerDialog.FILE_FILTER.ALL_FILES FileListerDialog.FILE_FILTER.DIRECTORY_ONLY FileListerDialog.FILE_FILTER.IMAGE_ONLY FileListerDialog.FILE_FILTER.VIDEO_ONLY FileListerDialog.FILE_FILTER.AUDIO_ONLY
-
Finally call show() to open the dialog.
fileListerDialog.show();