summaryrefslogtreecommitdiffstats
path: root/screen_ui.cpp
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2013-07-31 20:28:24 +0200
committerDoug Zongker <dougz@android.com>2013-07-31 20:35:12 +0200
commitc0441d171914e59941ec4f815ae0aabf56d6504f (patch)
tree2382931433409feae532e7a7fb4ac05016336196 /screen_ui.cpp
parentMerge "start healthd in recovery" (diff)
downloadandroid_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.gz
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.bz2
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.lz
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.xz
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.zst
android_bootable_recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.zip
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 93e260936..6a638582e 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);
+}