refactor: move views to views sub folder
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
use crate::display::primary_lcd::PrimaryLcdDisplay;
|
||||
|
||||
use crate::navigation::navigation::{Action, Navigable};
|
||||
use crate::views::{menu_item, view::View};
|
||||
|
||||
use embedded_graphics::pixelcolor::Rgb565;
|
||||
use embedded_graphics::prelude::RgbColor;
|
||||
use embedded_graphics_core::draw_target::DrawTarget;
|
||||
pub const MAX_SELECTED: i8 = 2;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SettingsMenu {
|
||||
pub selected: i32,
|
||||
}
|
||||
|
||||
impl Navigable for SettingsMenu {
|
||||
fn display(
|
||||
&self,
|
||||
display: &mut PrimaryLcdDisplay<'static>,
|
||||
) -> impl core::future::Future<Output = ()> + Send {
|
||||
display.clear(Rgb565::BLACK).unwrap();
|
||||
menu_item::show(display, "System Inforation", 0, self.selected);
|
||||
menu_item::show(display, "Wifi Information", 1, self.selected);
|
||||
|
||||
core::future::ready(())
|
||||
}
|
||||
|
||||
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = View> + Send {
|
||||
async move { View::Settings(SettingsMenu { selected: 0 }) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user