chenxiaolong / RSAF

An Android Storage Access Framework document provider for rclone
GNU General Public License v3.0
188 stars 6 forks source link

golang gui #35

Open gedw99 opened 11 months ago

gedw99 commented 11 months ago

I am trying to integrate this with https://github.com/gioui/gio-x/blob/main/explorer/explorer_android.java

GIO is a golang GUI system that runs on everything. This is a GIO golang module that provides a File System Explorer. The link is to the Android target.

Any tips ?

chenxiaolong commented 11 months ago

I don't quite understand what you're asking for. Can you explain more about what you mean by integrating?

On Android, to access anything through RSAF, you'll have to use the Storage Access Framework API (similar to how you would access an SD card or any cloud provider). Normally, if apps want to open a file, they'll use the system file picker via the ACTION_OPEN_DOCUMENT intent. If an app wants to show it's own file picker, it must use the system file picker to select a directory first via the ACTION_OPEN_DOCUMENT_TREE intent, and then it can show the files inside.

gedw99 commented 11 months ago

Thanks for the explanation as I was not quite sure how the Storage Access Framework API is used.

Yeah sorry I realised later how I did not explain it at all well.

GIO is a GUI system and I was thinking about I can build an App that is able to tap into this Storage API, using RSAF

GIO has a sharing plugin that works on Android already. https://github.com/gioui-plugins/gio-plugins/tree/main/share btw.

Where I am stuck is how I can tap into your RSAF from GIO. The convention with GIO plugs is that it wants a .jar and .java file extension type. When I looked at your code did not see how I can compile to get that 2 files. You can see what I mean here: https://github.com/gioui-plugins/gio-plugins/blob/main/share/share_android.go

Does that help ?

chenxiaolong commented 11 months ago

I would suggest looking into this: https://developer.android.com/guide/topics/providers/document-provider.

There's no way to have your app talk to RSAF directly. It's not designed to be embedded like that. On Android, the Storage Access Framework always sits in the middle:

Client app   --> Android SAF API -->     Document Provider
(GIO, etc.)                          (RSAF, Google Drive, etc.)

GIO should only use the SAF API. Once that's implemented, it's automatically able to open and create files on any backend (whether it's RSAF, Google Drive, internal storage, an SD card, or any other document provider source).