GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - nbsp-team/MaterialFilePicker: Picking files since 2015

BranchesTags
Open more actions menu

Latest commit

 

History

153 Commits
153 Commits

Folders and files

NameName
Last commit message
Last commit date
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
library
library
 
 
ss
ss
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

Material File Picker Unofficial

Material file picker library for Android by Arte al Programar

What's new

  • Require Android Jelly Bean 4.1.x (API 16+)
  • Android 10 Compatibility
  • Material Components for Android Support
  • Night Mode Support
  • New Icon Designs

Add your project

Download library and add it to your project

or use JitPack.io

build.gradle (Project)

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}


build.gradle (Module: app)

dependencies {
    ...
    implementation 'com.github.arteaprogramar:Android_MaterialFilePicker:version'
}


Using (IMPORTANT)

  • Add to Values
colors.xml
<resources>
    ...
    <color name="colorBackground">#fafafa</color>
    ...
</resources>

styles.xml

<resources>

    ...
    <item name="android:colorBackground">@color/colorBackground</item>
    ...
</resources>

  • Open your class and add the following code
...
public static final int FILE_PICKER_REQUEST_CODE = 989
...

MaterialFilePicker()
    // Pass a source of context. Can be:
    //    .withActivity(Activity activity)
    //    .withFragment(Fragment fragment)
    //    .withSupportFragment(androidx.fragment.app.Fragment fragment)
    .withActivity(this)
    // With cross icon on the right side of toolbar for closing picker straight away
    .withCloseMenu(true)
    // Entry point path (user will start from it)
    .withPath(alarmsFolder.absolutePath)
    // Root path (user won't be able to come higher than it)
    .withRootPath(externalStorage.absolutePath)
    // Showing hidden files
    .withHiddenFiles(true)
    // Want to choose only jpg images
    .withFilter(Pattern.compile(".*\\.(jpg|jpeg)$"))
    // Don't apply filter to directories names
    .withFilterDirectories(false)
    .withTitle("Sample title")
    .withRequestCode(FILE_PICKER_REQUEST_CODE)
    .start()
...

Override on activity result:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == FILE_PICKER_REQUEST_CODE && resultCode == RESULT_OK) {
        String filePath = data.getStringExtra(FilePickerActivity.RESULT_FILE_PATH);
        // Do anything with file
    }
}

Themes

To create a compatible (Light/Dark) theme, you can change the following colors to suit your theme.

    <!-- App Colors -->
    <color name="colorPrimary">?colorPrimary</color>
    <color name="colorPrimaryDark">?colorPrimaryDark</color>
    <color name="colorAccent">?colorAccent</color>
    <color name="colorBackground">?android:colorBackground</color>

    <!-- Default Colors -->
    <color name="textColorPrimary">#212121</color>
    <color name="colorControlHighlight">#4000695C</color>

    <!-- (API 21 Status Bar Color) (API 23 Navigation Bar Color)-->
    <color name="colorPrimaryDarkVariant">#8a000000</color>

Runtime permissions:

You should handle runtime permissions in activity, from what you called Material File Picker. Look here for example code.

About

Picking files since 2015

Topics

androidandroid-libraryfile-pickermaterialpicker

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

1.2k stars

Watchers

40 watching

Forks

225 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.