Material Design File Picker library for Android , code with Kotlin .
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea 更新sdk编译版本 Aug 15, 2018
app 更新sdk编译版本 Aug 15, 2018
fancyfilepickerlibrary 更新sdk编译版本 Aug 15, 2018
gradle/wrapper 更新sdk编译版本 Aug 15, 2018
screenshots 3.0.0 README Oct 24, 2017
.gitignore version 1.0.0 Apr 14, 2017
LICENSE 增加单选和多选 Apr 21, 2017
README.md 代码整理 Mar 15, 2018
bintrayUpload.gradle 更新sdk编译版本 Aug 15, 2018
build.gradle 更新sdk编译版本 Aug 15, 2018
gradle.properties version 1.0.0 Apr 14, 2017
gradlew init Apr 12, 2017
gradlew.bat init Apr 12, 2017
settings.gradle init Apr 12, 2017

README.md

FancyFilePicker

使用Kotlin写的一个Android文件选择器,轻便,漂亮,尽量遵循Material Design

分类选择 本地目录 单选 图片选择器

使用

在gradle文件添加引用:

dependencies {
	compile 'net.muliba.fancyfilepickerlibrary:fancyfilepickerlibrary:3.0.0'
}

Kotlin中使用

FilePicker()
        .withActivity(this)
        .requestCode(0)
        .start()

接收结果:

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == 0) {
            val array = data?.getStringArrayListExtra(FilePicker.FANCY_FILE_PICKER_ARRAY_LIST_RESULT_KEY)
            ...
            return
        }
    }
    super.onActivityResult(requestCode, resultCode, data)
}

单选:

FilePicker()
	.withActivity(this)
    .requestCode(0)
    .chooseType(FilePicker.CHOOSE_TYPE_SINGLE)
    .start()

接收结果:

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == 0) {
           val result = data?.getStringExtra(FilePicker.FANCY_FILE_PICKER_SINGLE_RESULT_KEY)
            ...
            return
        }
    }
    super.onActivityResult(requestCode, resultCode, data)
}

JAVA中使用

new FilePicker().withActivity(this)
                .requestCode(0)
                .chooseType(FilePicker.CHOOSE_TYPE_SINGLE())
                .start();

还有别忘了添加权限:

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