abhishekti7 / UnicornFilePicker

:eyes: A simple, documented, and contribution-friendly File Picker for Android.
Apache License 2.0
69 stars 13 forks source link

showOnlyDir not implemented ?? #3

Closed jplente closed 3 years ago

jplente commented 3 years ago

Hi, I appreciate your work : this chooser is fine and light, easy to implement ! But it seems that setShowOnlyDir(true) is not working (this parameter not recognized at compile time) Is this functionality implemented ?

abhishekti7 commented 3 years ago

Hello @jplente , Thank you for the kind words. Regarding your issue, the method setShowOnlyDir(bool) works just fine. In fact, in the example project, the first implementation demonstrates just that. If you clone and run the example, you will find that the first option opens a file chooser specifically for directories.

For your further reading, https://github.com/abhishekti7/UnicornFilePicker/blob/94c5d863137dea48a3322f34060549cea3c5f48e/UnicornFilePicker/src/main/java/abhishekti7/unicorn/filepicker/ui/FilePickerActivity.java#L199-L217

Thanks again and happy coding!

jplente commented 3 years ago

Err Hello @abhishekti7 Thanks for this prompt reply FYI I work with Android Studio My problem is that when i code as suggested this button_import.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { UnicornFilePicker.from(Params_Database_Fragment.this) .addConfigBuilder() .selectMultipleFiles(false) .setShowOnlyDir(true) .setRootDirectory(Environment.getExternalStorageDirectory().getAbsolutePath()) .showHiddenFiles(false) .setFilters(new String[]{"dbk","db"}) .addItemDivider(true) .theme(R.style.UnicornFilePicker_Default) .build() .forResult(Constants.REQ_UNICORN_FILE);

            List<String> mSelected_files;
        }

Th line with setShowOnlyDir(true) is red written because not known by the compiler...

In my build.graddle (app) : implementation 'com.github.abhishekti7:UnicornFilePicker:1.0.1' Is the UnicornFilePicker:1.0.1 including theOnlyDir option ?

Thanks in advance ! jplente

abhishekti7 commented 3 years ago

Hey, Thank you so much for pointing this out. I must have been working on this and several features and added them in the documentation without releasing the next version. The new version is out and so is the feature. Thanks.

jplente commented 3 years ago

Hello, Thank you for your reply however, I tryied with graddle instruction implementation 'com.github.abhishekti7:UnicornFilePicker:1.0.2'

After syncing, i got the same error : .setShowOnlyDir(true) not known by the compiler.

abhishekti7 commented 3 years ago

Hey, I think the method that you are looking for is showOnlyDirectory() instead of setShowOnlyDir(true). Let me know if the issue is resolved.

jplente commented 3 years ago

Hello It works, you were right ! I don't know why i wrote "setShowOnlyDir(true) " into my code, perhaps a wrong copy/paste... :( Issue is resolved, thanks a lot for your active and prompt involvement ! JPL

jplente commented 3 years ago

It works with showOnlyDirectory() ! Thanks !