use jnim::JEnv; use super::{Platform, WinRef}; use crate::android; pub struct WinEvent<'a>(pub &'a ()); impl<'a> types::IntoEvt for WinEvent<'a> { fn to_evt(&self, _win: WinRef<'_>) -> Option { // TODO None } } impl<'a> types::IntoEvt for WinEvent<'a> { fn to_evt(&self, _win: WinRef<'_>) -> Option { // TODO None } } pub struct WinKey<'a>(pub &'a android::view::KeyEvent, pub &'a JEnv); impl<'a> types::IntoEvt for WinKey<'a> { fn to_evt(&self, _win: WinRef<'_>) -> Option { let evt = self.0; let env = self.1; log::warn!("EvtKey=======");// TODO use android::view::KeyEvent; match evt.get_action(env)? { KeyEvent::ACTION_DOWN => None, KeyEvent::ACTION_UP => None, _ => None, } } } pub struct WinTouch<'a>(pub u8, pub &'a android::view::MotionEvent, pub &'a JEnv); impl<'a> types::IntoEvt for WinTouch<'a> { fn to_evt(&self, _win: WinRef<'_>) -> Option { let evt = self.1; let env = self.2; log::warn!("EvtTouch======");// TODO use android::view::MotionEvent; let phase = match evt.get_action(env)? { MotionEvent::ACTION_DOWN => types::Phase::Start, MotionEvent::ACTION_UP => types::Phase::End, MotionEvent::ACTION_MOVE => types::Phase::Update, MotionEvent::ACTION_CANCEL => types::Phase::Cancel, _ => return None, }; let point = (evt.get_x(env)?, evt.get_y(env)?); let metas = types::Metas::EMPTY; let mouse = types::EvtMouse::new(types::Button::Touch(self.0), phase, point, metas); let force = 0; Some(types::EvtTouch::new(mouse, force)) } }