From 66dbf63080dad0bd2db70b47eca124d7df53e32d Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Thu, 11 Oct 2018 16:54:50 -0700 Subject: Implement the graphic menus As we plan to show localized rescue party dialogs under recovery mode with pre-generated images, it becomes necessary to show the menu headers and items with images. This cl converts the menu class to a interface and derived TextMenu & GraphicMenu classes. And the GraphicMenu uses GRSurfaces* as the menu header and a list of GRSurfaces* as menu items. Moreover, factor out the Draw* functions in the ScreenUI into a separate DrawInterface. Therefore, the Menu class can access these draw functions and use them to implement the DrawHeaders & DrawItems neatly. Bug: 74397117 Test: unittests pass, boot into recovery and check menu Change-Id: I95cee30f3e5eb666eb6fbcdfc873a7260fc177c1 --- wear_ui.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'wear_ui.cpp') diff --git a/wear_ui.cpp b/wear_ui.cpp index 3b057b761..8f3bc7bbe 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -73,7 +73,7 @@ void WearRecoveryUI::draw_screen_locked() { if (!show_text) { draw_foreground_locked(); } else { - SetColor(TEXT_FILL); + SetColor(UIElement::TEXT_FILL); gr_fill(0, 0, gr_fb_width(), gr_fb_height()); // clang-format off @@ -99,8 +99,9 @@ void WearRecoveryUI::StartMenu(const std::vector& headers, const std::vector& items, size_t initial_selection) { std::lock_guard lg(updateMutex); if (text_rows_ > 0 && text_cols_ > 0) { - menu_ = std::make_unique(scrollable_menu_, text_rows_ - menu_unusable_rows_ - 1, - text_cols_ - 1, headers, items, initial_selection); + menu_ = std::make_unique(scrollable_menu_, text_rows_ - menu_unusable_rows_ - 1, + text_cols_ - 1, headers, items, initial_selection, + char_height_, *this); update_screen_locked(); } } -- cgit v1.2.3