nbsp-team / materialfilepicker Goto Github PK
View Code? Open in Web Editor NEWPicking files since 2015
License: Apache License 2.0
Picking files since 2015
License: Apache License 2.0
I so that you use the GPL 2.0 licence. I want to use my app commercially. Can you use Apache?
Great tool, but I would like to know if it is possible to filter 2 or more file types. For example in my app I want the user to be able to pick only mp3 files, so i used this line
.withFilter(Pattern.compile(".*\\.mp3$"))
But now what if i wanted the user to be able to choose also .ogg file? How could I achieve that?
Can increase the function of multiple choice
Hey,
When i am compiling this library it changing my whole app name to 'MaterialFilePicker'.
Maybe this is because you have a @string/app_name resource that overrides mine.
A FAB with the option to create a file or folder would be nice. maybe use this layout ?
(That specific implementation was done using https://github.com/Clans/FloatingActionButton)
Hi,
How can I put some extra in the intent that would open not the starting directory, but app's directory or any else directory that I wish?
Just something like this implemented would be very appreciated:
intent.putExtra(FilePickerActivity.ARG_PATH, /*My path*/);
Hi,
Is possible to create directories with this lib?
Thanks
Using version 1.6 on Google Pixel. If I change the orientation of the device from portrait to landscape while picking a file, the current directory moves up (ala cd ..
).
Invoked as
new MaterialFilePicker().withActivity(a).withRequestCode
(1).withFilter(Pattern.compile(".*\\.mp3")).withHiddenFiles(false).withPath
(lastDirectory);
Is this expected behavior?
If the current path is sent, but not the root path.
The cause is here
This is due to my assumption that the current path would be the path where the picker starts. Now I'm using the root path and everything is ok. What is the purpose of the Current Path, then?
Is it possible to show only directories with specific file type(say .mp3) ?
Hello!
What was the reason to downgrade support libraries version from 23.2.0?
If there was some bugs, have you tested 23.2.1 version, which has a lot of bugfixes?
Support libraries 23.2 bring Vector Drawables, which can be used there.
Hello,
In my app I am opening large obj files, so when I click on such file, the phone is lagging on the FilePickerActivity, and returns to my activity when my file is already opened. I assume that's actually not your problem or fault. Although I would be very appreciate if you implemented some mechanism such as progressView while the clicked file is being loaded OR to return to my activity immediately after it's clicked, so the process of loading is going there visually...
Thanks in advance.
How can set more than one filter ?
for example just show .txt files and .mp4 files !
how ?
Is there any minimum requirement to use this lib?
I'm planning to use this in my project, but can't find any details about requirements needed. (My project min sdk API16 and targeting API25).
if i use this MaterialFilePicker and set filter i dont get any results
new MaterialFilePicker()
.withActivity(QuickCvRegistration.this)
.withRequestCode(12346)
.withFilter(Pattern.compile(".*.txt$")) // Filtering files and directories by file name using regexp
.withFilterDirectories(true) // Set directories filterable (false by default)
.withHiddenFiles(true) // Show hidden files and folders
.start();
Fast open/close activity.
java.lang.IllegalStateException: Activity has been destroyed
at android.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1352)
at android.app.BackStackRecord.commitInternal(BackStackRecord.java:597)
at android.app.BackStackRecord.commit(BackStackRecord.java:575)
at com.nbsp.materialfilepicker.ui.FilePickerActivity.addFragmentToBackStack(FilePickerActivity.java:136)
at com.nbsp.materialfilepicker.ui.FilePickerActivity.handleFileClicked(FilePickerActivity.java:180)
at com.nbsp.materialfilepicker.ui.FilePickerActivity.access$000(FilePickerActivity.java:24)
at com.nbsp.materialfilepicker.ui.FilePickerActivity$1.run(FilePickerActivity.java:173)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5135)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
at dalvik.system.NativeStart.main(Native Method)
Is there any way to filter directories those contain specified extension files?
This library is not working with Android version >= 6.
No directories are shown probably because of permission-granting related issue mentioned here #13
I tested this libarry on device with Android 4.4 and it works and looks nice there. So would be great to have support for the newest Android versions too ;)
I was updated your lib to 1.03 and SwipeRefreshLayout died. If I do a downgrade to 1.02 it works again but appears the bug with the language...
Is it possible to select a different directory for the filepicker? Im working with large files and these need to be selected from the SD card
use it like Readme.MD
and
I expect to see all files, but all directories on device are empty. What am I doing wrong ?
Opening filePicker like this
new MaterialFilePicker()
.withActivity(this)
.withRequestCode(1)
.start();
I expect to see all files, but all directories on device are empty. What am I doing wrong ?
Please change the title type as SpannableString
.withRootPath or .withPath tryng to set to /storage/emulated/0/
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.memozz.myapplication/com.nbsp.materialfilepicker.ui.FilePickerActivity}: java.lang.NullPointerException: storage == null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:134)
Caused by: java.lang.NullPointerException: storage == null
at java.util.Arrays$ArrayList.<init>(Arrays.java:38)
at java.util.Arrays.asList(Arrays.java:155)
at com.nbsp.materialfilepicker.utils.FileUtils.getFileListByDirPath(FileUtils.java:16)
at com.nbsp.materialfilepicker.ui.DirectoryFragment.initFilesList(DirectoryFragment.java:84)
at com.nbsp.materialfilepicker.ui.DirectoryFragment.onViewCreated(DirectoryFragment.java:79)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:988)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
at android.app.BackStackRecord.run(BackStackRecord.java:793)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1535)
at android.app.FragmentController.execPendingActions(FragmentController.java:325)
at android.app.Activity.performStart(Activity.java:6267)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:134)
Is there some kind of documentation? What means all the option?
Difference between withRootPath and withPath?
Is it possible to set the path parent to data? (So the user could select SD card)
Thank you in advance,
how can i change the default color blue to my own theme ?
Thank you very much for this library.
I am having issue to get the selected file name from inside the Fragment, as
onActivityResult
is not working (called) in fragment.
How to make this work?
Thanks.
Could you please provide support for Light/Dark themes, esp. the used icons. Thanks.
I want to add more than one extension filter to MaterialFilePicker (for example .doc & .docx).
What should I do?
It must be https, not http. I won't sync successfully when using http. : )
No matter what I put in filter I always getting empty directiry.
I tried like it explained in
pull 20
but still can't get any directory
I would be great to have a way to filter file types by extension, for example: *.pdf, *.jpg
Thanks in advance!
I put the request code = 1 as you said. The request code that gets to the onActivityResult is 131073.
The ARG_FILE_FILTER
shown in the readme doesn't exist. Apparently it was replaced by ARG_FILTER
. But it doesn't work.
intent.putExtra(FilePickerActivity.ARG_FILTER, Pattern.compile(".*\\.txt$"));
...results in this crash:
FATAL EXCEPTION: main
Process: com.chalcodes.maps, PID: 5164
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.chalcodes.maps/com.nbsp.materialfilepicker.ui.FilePickerActivity}: java.lang.ClassCastException: java.util.regex.Pattern cannot be cast to com.nbsp.materialfilepicker.filter.CompositeFilter
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: java.lang.ClassCastException: java.util.regex.Pattern cannot be cast to com.nbsp.materialfilepicker.filter.CompositeFilter
at com.nbsp.materialfilepicker.ui.FilePickerActivity.initArguments(FilePickerActivity.java:62)
at com.nbsp.materialfilepicker.ui.FilePickerActivity.onCreate(FilePickerActivity.java:47)
at android.app.Activity.performCreate(Activity.java:6010)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Using the following code I am not able to get to the required directory when the file picker starts. I use the withPath(String path)
method, because I want the user to go back and forth from that particular directory. It only changes the toolbar path text. But the file picker starts from the root directory instead of the specified directory. Can you please tell me what is wrong?
new MaterialFilePicker()
.withActivity(MainActivity.this)
.withRequestCode(500)
.withPath(Environment.getExternalStorageDirectory().toString() + "/myFolder")
.withFilter(Pattern.compile(".*\\.*$")) // Filtering files and directories by file name using regexp
.withFilterDirectories(true) // Set directories filterable (false by default)
.withHiddenFiles(true) // Show hidden files and folders
.start();
The documentation states about withPath() method:
Specifies start directory for picker, which will be shown to user at the beginning
Unable to access memory card only directories are shown .. no file is displaying in memory card
Hi
Is there any way to show thumbnail of video or image in the list instead of showing static icon? This will help user to choose his/her file more easily :)
I want to set the default path using withPath and yet the explorer shows the root directory content.
new MaterialFilePicker()
.withActivity((Activity) mContext)
.withPath(Environment.getExternalStorageDirectory().getAbsolutePath() + Constants.DEFAULT_DIRECTORY)
.withRequestCode(Constants.RESTORE_FILE_PICK_REQUEST)
.withHiddenFiles(true)
.start();
Whatever goes in that function is a valid directory.
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve com.nbsp:library:1.01.
inconsistent module metadata found. Descriptor: com.nbsp:material-file-picker:1.01 Errors: bad module name: expected='library' found='material-file-picker'
Your demo shows the use of .withTitle("Sample title")
but that method is not defined 😞
How do i choose language? I some phones the language is set to Russian and in other it set to English. I want the language to be English all the time...
Hi!
You should use this manual and add
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, SOME_REQUEST_CONSTANT);
to FilePickerActivity.onCreate() to provide your library with access to external storage. Otherwise it will not work on Android M.
P.S. And please make minSdkVersion = 10 for your library to cover all active android versions on market. Thanks.
Error:(60, 13) Failed to resolve: com.nbsp:library:1.01
Show in File
Show in Project Structure dialog
In example project there is example filter for txt files:
.withFilter(Pattern.compile(".*.txt$"))
But if there is ".test" file in the directory, it wont be filtered.
Futhermore, if .withFilterDirectories is set to true, there will be directories in the list.
So, let's try next config:
new MaterialFilePicker()
.withActivity(this)
.withRequestCode(1)
.withFilterDirectories(true)
.withFilter(Pattern.compile(".*.txt$"))
.withHiddenFiles(true)
.start();
Look at the next screenshot:
5 items except ".test.txt" should not be there.
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve com.nbsp:library:1.01.
Required by:
chocoprint:app:unspecified
> Could not resolve com.nbsp:library:1.01.
> inconsistent module metadata found. Descriptor: com.nbsp:material-file-picker:1.01 Errors: bad module name: expected='library' found='material-file-picker'
> Could not resolve com.nbsp:library:1.01.
> Could not get resource 'http://dl.bintray.com/lukaville/maven/com/nbsp/library/1.01/library-1.01.pom'.
> Could not HEAD 'http://dl.bintray.com/lukaville/maven/com/nbsp/library/1.01/library-1.01.pom'.
> ukproxycam.paconsulting.com
I am trying to filter out multiple file types using the regex below:
^.*.(?!apk$|dmg$|exe$|ipa$|app$)[^.]+$
When I test it online everything works as expected, but when I use it in the following snippet apk files are still shown. I am not a regex expert. Apologies if this is a simple question and thank you for the help!
new MaterialFilePicker()
.withActivity(this)
.withFilter(Pattern.compile("^.*\.(?!apk$|dmg$|exe$|ipa$|app$)[^.]+$"))
.withRequestCode(REQUEST_CODE_DOCUMENT_PICKER)
.withHiddenFiles(true) // Show hidden files and folders
.start();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.