NaraeImagePicker
NaraeImagePicker copied to clipboard
Android Pie hidden files issue
Image Picker also showing all the hidden files and it's child folders images in the folder list & all images list in case of Android 9.0 (Pie), which shouldn't be the intended behavior. But this case wasn't in there for Oreo.
Currently, we use MediaStore api to retrieve media files and Android hides hidden images (actually, directory contains .nomedia file) in their MediaStorr api.
This problem can be solve by 'filtering directory which contains '.nomedia' file, but i think that issues doesn't occur in all of android pie device. (Maybe we can make options to filter nomedia file..)
What about the child of '.nomedia' file like this tree: .noMedia -> Myfiles
or a complex tree like this. In this case Myfiles is also being filtered in the folder list.
In this stackchange, https://android.stackexchange.com/questions/187280/is-it-possible-to-have-a-media-folder-inside-a-nomedia-folder , .nomedia hides sub directories also. (Currently, i'm traveling without computer. Just mobile device)
I am not talking about just .nomedia file, what about manually created files with dot(.) extension like '.MyFiles' and it's child folders.
Since .nomedia hides subdirectory also, we can apply same rule for Directory startsWith '.' .
- Query all folders from MediaStore
- If options.ignoreHiddenFiles is true, Filter directory which startsWith '.'
- Query listFiles() about each folders
- Filter directory which contains '.nomedia'
- Query all media files in filtered directories from MediaStore
- ...
For complex tree, There's no sufficient solution to solve it. Maybe user can have nested 60 directories in one hidden folders...
Ya, I have already filtered the '.hiddenfiles', but I am stuck with the complex tree.
@deepakkumardk
I have an S10+ (G975N) with Android 10, and I've been doing some tests on my way back from travel.
Given that the software is beta software, the Gallery app and NaraeImagePicker guaranteed the same behavior.
The Complex tree seems to be irrelevant in that problem.
Case 1. Complex tree with .hideFolder
structure
sopme
- .hides
- somes
- .hidefolder
- test.jpg
- test.jpg
- test.jpg
- test.jpg
Test Result
- Gallery (which samsung one) show 'sompe' folders only. Non-hiding folders will ignore when that folders inside of hiding folders.
- NaraeImagePicker show 'sompe' folders only.
Case 2. Complex tree with .nomedia
structure
2w
- somes
- .hidefolder
- test.jpg
- test.jpg
- test.jpg
- .nomedia
Test Result
- Gallery doesn't shows our 2w folders.
- NaraeImagePicker also doesn't show 2w folders.
Also, nested folders are shown as their own rows, so it's easy to see if the folder name starts with a dot.
@WindSekirun, Actually this bug is everywhere I have checked WhatsApp, Telegram both were showing the hidden folders/Images as separate folders as in the folder view. Also I have look into the other ImagePicker library like Matisse, MediaPickerLib both were behaving the same for hidden file.
So, it's better to blame that it's a bug for OS of Android I am using or other way :-). Even that it's good to have to support for ignoreHiddenFiles
@deepakkumardk At the discretion, we will proceed with Won't fix. If you still need to implement ignoreHiddenFiles, there is a need for further discussion.
As I mentioned it's good to have support for ignoreHiddenFiles as no one wants to show/see their hidden files when they are uploading pictures or accessing them from other galleries. And also it's a small but an effective change from the perspective of UX and for privacy too. So, I think we should go for the fix.