foxsake/android-folder-picker-library


A light-weight android library that can be quickly integrated into any app to let users choose folder, also files (but esp built for folders).

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.foxsake:android-folder-picker-library:v2.2'
	}
	dependencies {
		implementation("com.github.foxsake:android-folder-picker-library:v2.2")
	}
	<dependency>
	    <groupId>com.github.foxsake</groupId>
	    <artifactId>android-folder-picker-library</artifactId>
	    <version>v2.2</version>
	</dependency>

                            
    libraryDependencies += "com.github.foxsake" % "android-folder-picker-library" % "v2.2"
        
        

                            
    :dependencies [[com.github.foxsake/android-folder-picker-library "v2.2"]]
        
        

Readme


android-folder-picker-library

Demo Bintray Android Arsenal

A light-weight android library that can be quickly integrated into any app to let users choose folder, also files (but esp built for folders).

Example Uses

  • To let users choose folder for saving files
  • To let users choose backup folder
  • To let users pick files to upload etc...

Screenshots

|Preview | Preview | Preview | |:-------------------:|:------------------------:|:-----------------:| | Can pick folders | Can create folder | Can also pick file |

Installation

For your convenience, it is available on jCenter, So just add this in your app dependencies:

    compile 'lib.kashif:folderpicker:2.2'

Usage

To pick folder

Just start FolderPicker activity from your app

        Intent intent = new Intent(this, FolderPicker.class);
        startActivityForResult(intent, FOLDERPICKER_CODE);        

If the user selects folder/file, the name of folder/file will be returned to you on onActivityResult method with the variable name 'data'.

        
        protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
          if (requestCode == FOLDERPICKER_CODE && resultCode == Activity.RESULT_OK) {

              String folderLocation = intent.getExtras().getString("data");
              Log.i( "folderLocation", folderLocation );
            
          }
        }
        

Options

Cusstomization options can be passed as extras to FolderPicker activity.


       //To show a custom title
       intent.putExtra("title", "Select file to upload");
       
       //To begin from a selected folder instead of sd card's root folder. Example : Pictures directory
       intent.putExtra("location", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
       
       //To pick files
       intent.putExtra("pickFiles", true);

       //To set on landscape mode
       intent.putExtra("landscape", true);
       

Click here to see an example

License

Copyright 2017 Kashif Anwaar.

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.