BoardiesITSolutions / FileDirectoryPicker

Simple directory/file picker for Android
MIT License
8 stars 2 forks source link

Possibility to set current folder for FolderPicker and handle multiple External storages #2

Closed Mandrakia closed 5 years ago

Mandrakia commented 5 years ago

It would be great if we could set the starting folder for the FolderPicker. Another feature would be to handle the case when there are multiple ExternalStorage paths (ie : external storage, SDCard external storage etc)

Perfect case in the breacrumbs above the folder there would be a spinner to select the external storage to use.

boardy commented 5 years ago

That is something on our plans to do to set the start location for the file and directory picker.

The other point about switching between internal and external storage is also something we plan on adding but having a quick butchers at how to implement this, its not overly obvious how its done. It looks the Android API doesn't specifically have a way of doing it and the internal storage is mostly used by the actual app to keep the data for a app private to that app, and the external storage is a shared space for anything. Although saying that I've seen file explorers let you switch the view between internal and external storage so it must be possible, I'll just need to investigate a little further.

Are these 2 things stopping your from using the library at the moment so need it sooner rather than later?

Mandrakia commented 5 years ago

I was talking about external storageS Some phones have the usual internal/external + 1 sd card. You can list the different external storages with : ContextCompat.getExternalFilesDirs(context,null)

boardy commented 5 years ago

Ah OK. I didn't see that when I had a quick Google. Will look into implementing it as soon as I can.

Mandrakia commented 5 years ago

That's great to save you time searching you can get to the root of the different external storages by going back 4 levels from the output of ContextCompat.getExternalFilesDirs.

so something like result[0].parentFile.parentFile.parentFile.parentFile

boardy commented 5 years ago

I've started looking into implementing this this evening. It looks like there's a known issue where getExternalFiles might not work on the Android Emulator for some reason, which seems to be the case as although my emulator has an SD card, it only ever finds one storage location which is the internal storage.

To get round this I've ordered a second hand Android phone off ebay that has an SD Card slot which should arrive in the next couple of weeks so hopefully once that arrives I can get this implemented and tested for you.

boardy commented 5 years ago

Hi, sorry for the delay in getting back to you. I've got the new phone with the SD card support now so looking into implementing so hopefully will get an update out to you in the not too distant future.

boardy commented 5 years ago

Hi sorry, for the delay in getting back to you on this.

I've implemented your suggestion to be able to add a start directory. The suggestion for adding the option to allow the user to do internal/external storage on the other hand is causing me a little trouble.

From what I've read, apps aren't supposed to be able to write to an SD card where ever it wants, and I've looked at a couple of open source file manager apps to see how they do it, but none of them seem to be able to switch between internal and external storage. The only one I've found that does work is solid explorer however its not open source so can't see how its doing it.

I can release what I have so far with the start directory being implemented but not sure where to go from here regarding the internal and external storage. I've created a stackoverflow post you can find at https://stackoverflow.com/questions/54813908/allow-user-to-switch-between-internal-and-external-storage-locations-on-android/54851866#comment96513967_54851866.

Thanks

Chris

boardy commented 5 years ago

No further feedback so closing - will reopen if required or if anyone else wants this or has any input then I'll reopen the issue.