From c0441d171914e59941ec4f815ae0aabf56d6504f Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 31 Jul 2013 11:28:24 -0700 Subject: notify about pending long press Recovery changes: - add a method to the UI class that is called when a key is held down long enough to be a "long press" (but before it is released). Device-specific subclasses can override this to indicate a long press. - do color selection for ScreenRecoveryUI's menu-and-log drawing function. Subclasses can override this to customize the colors they use for various elements. - Include the value of ro.build.display.id in the menu headers, so you can see on the screen what version of recovery you are running. Change-Id: I426a6daf892b9011638e2035aebfa2831d4f596d --- screen_ui.cpp | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'screen_ui.cpp') diff --git a/screen_ui.cpp b/screen_ui.cpp index 93e2609..6a63858 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -196,9 +196,29 @@ void ScreenRecoveryUI::draw_progress_locked() } } -#define C_HEADER 247,0,6 -#define C_MENU 0,106,157 -#define C_LOG 249,194,0 +void ScreenRecoveryUI::SetColor(UIElement e) { + switch (e) { + case HEADER: + gr_color(247, 0, 6, 255); + break; + case MENU: + case MENU_SEL_BG: + gr_color(0, 106, 157, 255); + break; + case MENU_SEL_FG: + gr_color(255, 255, 255, 255); + break; + case LOG: + gr_color(249, 194, 0, 255); + break; + case TEXT_FILL: + gr_color(0, 0, 0, 160); + break; + default: + gr_color(255, 255, 255, 255); + break; + } +} // Redraw everything on the screen. Does not flip pages. // Should only be called with updateMutex locked. @@ -208,37 +228,38 @@ void ScreenRecoveryUI::draw_screen_locked() draw_progress_locked(); if (show_text) { - gr_color(0, 0, 0, 160); + SetColor(TEXT_FILL); gr_fill(0, 0, gr_fb_width(), gr_fb_height()); int y = 0; int i = 0; if (show_menu) { - gr_color(C_HEADER, 255); + SetColor(HEADER); for (; i < menu_top + menu_items; ++i) { - if (i == menu_top) gr_color(C_MENU, 255); + if (i == menu_top) SetColor(MENU); if (i == menu_top + menu_sel) { // draw the highlight bar + SetColor(MENU_SEL_BG); gr_fill(0, y-2, gr_fb_width(), y+char_height+2); // white text of selected item - gr_color(255, 255, 255, 255); + SetColor(MENU_SEL_FG); if (menu[i][0]) gr_text(4, y, menu[i], 1); - gr_color(C_MENU, 255); + SetColor(MENU); } else { if (menu[i][0]) gr_text(4, y, menu[i], i < menu_top); } y += char_height+4; } - gr_color(C_MENU, 255); + SetColor(MENU); y += 4; gr_fill(0, y, gr_fb_width(), y+2); y += 4; ++i; } - gr_color(C_LOG, 255); + SetColor(LOG); // display from the bottom up, until we hit the top of the // screen, the bottom of the menu, or we've displayed the @@ -585,3 +606,10 @@ void ScreenRecoveryUI::ShowText(bool visible) update_screen_locked(); pthread_mutex_unlock(&updateMutex); } + +void ScreenRecoveryUI::Redraw() +{ + pthread_mutex_lock(&updateMutex); + update_screen_locked(); + pthread_mutex_unlock(&updateMutex); +} -- cgit v1.1