google / modernstorage

ModernStorage is a group of libraries that provide an abstraction layer over storage on Android to simplify its interactions
https://google.github.io/modernstorage/
Apache License 2.0
1.24k stars 60 forks source link

[filesystem] Make `PlatformContract` methods match `DocumentsContract` #37

Closed nic0lette closed 3 years ago

nic0lette commented 3 years ago

Instead of various methods which are identical, or almost identical, to the DocumentsContract, make PlatformContract define an interface which matches the Android version (with the exception of using java.net.URI rather than android.net.Uri for testing on non-Android devices)

Interface or abstract class? Both could have default implementations that would allow defining helper methods.

Perhaps best would be an interface for DocumentsContract and then a class that uses that interface for defining lower level helper methods that can be used by the filesystem classes without worrying about DocumentsContract at all.

nic0lette commented 3 years ago

Using java.net.URI is probably a Bad Idea. The rest of this is a Good Idea. Instead of java.net.URI, methods should take DocumentPath, since it works on both Android and host tests, but doesn't end up converting a Path to a java.net.URI just to convert it to an android.net.Uri.

nic0lette commented 3 years ago

This is mostly done in dev now.