Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Android adapter #500

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open

feat: Android adapter #500

wants to merge 38 commits into from

Conversation

mwcampbell
Copy link
Contributor

I think the Android adapter is now complete enough to start reviewing.

My current main test case and demo for this adapter is this sample project, which uses a slightly modified version of GameActivity: https://github.com/[mwcampbell/xilem-to-do-mvc-android](https://github.com/mwcampbell/xilem-to-do-mvc-android)

We may debate the division of responsibilities between the native and Java code. Perhaps it would be better if more things were implemented on the native side. To some extent, I just implemented things on the Java side when it was more convenient to write them in Java because of the number of Java method calls required. But I think there's also some logic to my decisions. For example, the current Java implementations of the various event-sending methods post asynchronous requests to the UI thread, but one could imagine an alternate implementation that assumes it's being called on the UI thread and sends the events synchronously. The lower-level Adapter type is designed to support such alternate implementations, as mentioned in that types documentation, though no such implementations exist yet (as they'd require a different Android activity class and using something other than winit). I also thought it made sense to store Android-specific state, such as the accessibility focus and current hover (explore-by-touch) node, on the Java side, but am willing to revisit that.

I guess we should have CI tasks to verify the Java code formatting and check that the prebuilt .dex file matches the source code. I included the script I'm using to build the .dex. It works on my Mac with my particular Android SDK installation. I don't know if it's really necessary to target Java 7, but I remembered reading that Java 8 and above required some tools for desugaring lambdas and possibly other newer features, and I didn't want to try to figure out how to make that work outside of a typical Gradle project. As for whether we should actually use a typical Gradle project, I don't know if that can build a .dex outside the context of a full Android application.

…tangle. But NativeActivity seems to be sabotaging this.
…k text traversal problem, which now appears to be a bug in TalkBack. But also be more consistent about only exposing text selection when the node is focused, because that does seem to be what TalkBack expects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant