aboutsummaryrefslogtreecommitdiffstats
path: root/screen_ui.cpp
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2013-07-31 11:28:24 -0700
committerDoug Zongker <dougz@android.com>2013-07-31 11:35:12 -0700
commitc0441d171914e59941ec4f815ae0aabf56d6504f (patch)
tree2382931433409feae532e7a7fb4ac05016336196 /screen_ui.cpp
parent3c3ee3bc33d35cf3939f57f6c649459280b57827 (diff)
downloadbootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.gz
bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.bz2
bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.zip
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
Diffstat (limited to 'screen_ui.cpp')
-rw-r--r--screen_ui.cpp48
1 files changed, 38 insertions, 10 deletions
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);
+}