KnotFileChooser-Android

Knot File Chooser with Android.

KnotFileChooser-Android

To get a Git project into your build:

Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

dependencies {
	        implementation 'com.github.iammohdzaki:KnotFileChooser-Android:1.0.3'
	}

How To Use

KnotFileChooser(this,
            allowBrowsing = true, // Allow User Browsing 
            allowCreateFolder = true, // Allow User to create Folder
            allowMultipleFiles = false, // Allow User to Select Multiple Files
            allowSelectFolder = false, // Allow User to Select Folder
            minSelectedFiles = 0, // Allow User to Selec Minimum Files Selected
            maxSelectedFiles = 0, // Allow User to Selec Minimum Files Selected
            showFiles = true, // Show Files or Show Folder Only
            showFoldersFirst = true, // Show Folders First or Only Files
            showFolders = true, //Show Folders
            showHiddenFiles = false, // Show System Hidden Files
            initialFolder = Environment.getExternalStorageDirectory(), //Initial Folder 
            restoreFolder = false, //Restore Folder After Adding
            cancelable = true) //Dismiss Dialog On Cancel (Optional)
            .title("Select a File") // Title of Dialog
            .sorter(Sorter.ByNewestModification) // Sort Data (Optional)
	    fileType = KnotFileChooser.FileType.ALL //Select Which Files you want to show (By Default : ALL)
            .onSelectedFilesListener { // Callback Returns Selected File Object  (Optional)
                Toast.makeText(this, it.toString(), Toast.LENGTH_SHORT).show()
            }
	    .onSelectedFileUriListener { // Callback Returns Uri of File (Optional)
               
            }
            .show()

File Types

enum class FileType{
        ALL,
        IMAGE,
        DB,
        DOC,
        PDF,
        MUSIC,
        VIDEO,
        CODE
    }

Additional Feature

//If you want user to select a path to save a file then
	 minSelectedFiles = 0, // Allow User to Selec Minimum Files Selected
         maxSelectedFiles = 0, // Allow User to Selec Minimum Files Selected
	 //This will automatically return the path

Customise

<!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="kfc_theme_background">@color/corDefundo</item>
        <item name="kfc_theme_foreground">@color/colorPrimary</item>
        <item name="kfc_theme_title">@color/cinzaEscuro</item>
        <item name="kfc_theme_breadcrumb">@color/azulClaro</item>
        <item name="kfc_theme_toolbox">@color/colorPrimary</item>
        <item name="kfc_theme_search_text">@color/cinzaEscuro</item>
        <item name="kfc_theme_search_hint">@color/cinzaClaro</item>
        <item name="kfc_theme_status">@color/colorPrimary</item>
        <item name="kfc_theme_file_icon">@color/colorPrimary</item>
        <item name="kfc_theme_file_name">@color/colorPrimary</item>
        <item name="kfc_theme_file_information">@color/colorAccent</item>
        <item name="kfc_theme_file_flag">@color/cinzaClaro</item>
        <item name="kfc_theme_file_asterisk">@color/amarelo</item>
        <item name="kfc_theme_checkbox">@color/colorAccent</item>
        <item name="kfc_theme_cancel_button">@color/colorAccent</item>
        <item name="kfc_theme_ok_button">@color/colorAccent</item>
        <item name="kfc_theme_create_folder_button">@color/verde</item>
    </style>

Permissions

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

GitHub