singhangadin / android-filepicker

Selecting directories/files made a lot easier.
Apache License 2.0
651 stars 139 forks source link

onSelectedFilePaths() returning deselected file paths #48

Closed ratanlp closed 7 years ago

ratanlp commented 7 years ago

I have a requirement where user can select/deselect dirs paths. So after using dialog.markFiles(filePaths), and when the user is deselecting the path, still the onSelectedFilePaths() method returns deselected file paths along with selected paths.

singhangadin commented 7 years ago

Are you sure that all the file paths that were pre-marked using dialog.markFiles(filePaths) were deselected? Please verify it again.

ratanlp commented 7 years ago

The file paths that are marked are selected. The issue is when trying to deselect already marked ones.

singhangadin commented 7 years ago

Hi, Apologies for getting back too late!. I think I have found the cause for this issue. The problem is that there can be multiple ways to define path of a directory, for eg.: /mnt/sdcard/.VOD/100.png and /sdcard/.VOD/100.png both of these paths are valid and correct for a file. However the path strings are different. This is due to internal directory structure of android which emulates /mnt/sdcard as /sdcard in its directory structure (See here). As a solution to this, I will suggest you to use same path structure for files as of used in library (I am using absolute path for linking files). This will help in pin pointing your marked files in library's list. Apart from that, thanks to you for informing, I thoroughly studied the method, and have found a bug in markFiles method (which was marking all files as directory) which has been fixed by now.