pub struct Adapter { /* private fields */ }Expand description
Low-level AccessKit adapter for Android.
This layer provides maximum flexibility in the application threading
model, the interface between Java and native code, and the implementation
of action callbacks, at the expense of requiring its caller to provide
glue code. For a higher-level implementation built on this type, see
InjectingAdapter.
Implementations§
Source§impl Adapter
impl Adapter
Sourcepub fn update_if_active(
&mut self,
update_factory: impl FnOnce() -> TreeUpdate,
) -> Option<QueuedEvents>
pub fn update_if_active( &mut self, update_factory: impl FnOnce() -> TreeUpdate, ) -> Option<QueuedEvents>
If and only if the tree has been initialized, call the provided function
and apply the resulting update. Note: If the caller’s implementation of
ActivationHandler::request_initial_tree initially returned None,
the TreeUpdate returned by the provided function must contain
a full tree.
If a QueuedEvents instance is returned, the caller must call
QueuedEvents::raise on it.
This method may be safely called on any thread, but refer to
QueuedEvents::raise for restrictions on the context in which
it should be called.
Sourcepub fn create_accessibility_node_info<'local, H: ActivationHandler + ?Sized>(
&mut self,
activation_handler: &mut H,
env: &mut JNIEnv<'local>,
host: &JObject<'_>,
virtual_view_id: jint,
) -> JObject<'local>
pub fn create_accessibility_node_info<'local, H: ActivationHandler + ?Sized>( &mut self, activation_handler: &mut H, env: &mut JNIEnv<'local>, host: &JObject<'_>, virtual_view_id: jint, ) -> JObject<'local>
Create an AccessibilityNodeInfo for the AccessKit node
corresponding to the given virtual view ID. Returns null if
there is no such node.
The host parameter is the Android view for this adapter.
It must be an instance of android.view.View or a subclass.
Sourcepub fn find_focus<'local, H: ActivationHandler + ?Sized>(
&mut self,
activation_handler: &mut H,
env: &mut JNIEnv<'local>,
host: &JObject<'_>,
focus_type: jint,
) -> JObject<'local>
pub fn find_focus<'local, H: ActivationHandler + ?Sized>( &mut self, activation_handler: &mut H, env: &mut JNIEnv<'local>, host: &JObject<'_>, focus_type: jint, ) -> JObject<'local>
Create an AccessibilityNodeInfo for the AccessKit node
with the given focus type. Returns null if there is no such node.
The host parameter is the Android view for this adapter.
It must be an instance of android.view.View or a subclass.
Sourcepub fn perform_action<H: ActionHandler + ?Sized>(
&mut self,
action_handler: &mut H,
virtual_view_id: jint,
action: &PlatformAction,
) -> Option<QueuedEvents>
pub fn perform_action<H: ActionHandler + ?Sized>( &mut self, action_handler: &mut H, virtual_view_id: jint, action: &PlatformAction, ) -> Option<QueuedEvents>
Perform the specified accessibility action.
If a QueuedEvents instance is returned, the caller must call
QueuedEvents::raise on it, and the Java performAction method
must return true. Otherwise, the Java performAction method
must either handle the action some other way or return false.
This method may be safely called on any thread, but refer to
QueuedEvents::raise for restrictions on the context in which
it should be called.
Sourcepub fn on_hover_event<H: ActivationHandler + ?Sized>(
&mut self,
activation_handler: &mut H,
action: jint,
x: jfloat,
y: jfloat,
) -> Option<QueuedEvents>
pub fn on_hover_event<H: ActivationHandler + ?Sized>( &mut self, activation_handler: &mut H, action: jint, x: jfloat, y: jfloat, ) -> Option<QueuedEvents>
Handle the provided hover event.
The action, x, and y parameters must be retrieved from
the corresponding properties on an Android motion event. These
parameters are passed individually so you can use either a Java
or NDK event.
If a QueuedEvents instance is returned, the caller must call
QueuedEvents::raise on it, and if using Java, the event handler
must return true. Otherwise, if using Java, the event handler
must either handle the event some other way or return false.
This method may be safely called on any thread, but refer to
QueuedEvents::raise for restrictions on the context in which
it should be called.