TEST: button

tychovrahe/T3W1/devkit1_with_ble_sq3
tychovrahe 1 year ago
parent 2c6a995b03
commit cea0189dfd

@ -27,6 +27,7 @@ use render::{
homescreen, homescreen_blurred, HomescreenNotification, HomescreenText,
HOMESCREEN_IMAGE_HEIGHT, HOMESCREEN_IMAGE_WIDTH,
};
use crate::ui::event::{ButtonEvent, PhysicalButton};
use super::{theme, Loader, LoaderMsg};
@ -181,10 +182,17 @@ where
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
Self::event_usb(self, ctx, event);
if self.hold_to_lock {
Self::event_hold(self, ctx, event).then_some(HomescreenMsg::Dismissed)
if Self::event_hold(self, ctx, event) {
return Some(HomescreenMsg::Dismissed)
}
}
if let Event::Button(ButtonEvent::ButtonPressed(PhysicalButton::Power)) = event {
Some(HomescreenMsg::Dismissed)
} else {
None
}
}
fn paint(&mut self) {

Loading…
Cancel
Save