Adapter

Struct Adapter 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for Adapter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Adapter

Source§

fn default() -> Adapter

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.