diff options
author | Doug Zongker | 2013-07-31 13:28:24 -0500 |
---|---|---|
committer | Doug Zongker | 2013-07-31 13:35:12 -0500 |
commit | c0441d171914e59941ec4f815ae0aabf56d6504f (patch) | |
tree | 2382931433409feae532e7a7fb4ac05016336196 /screen_ui.cpp | |
parent | 3c3ee3bc33d35cf3939f57f6c649459280b57827 (diff) | |
download | platform-bootable-recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.gz platform-bootable-recovery-c0441d171914e59941ec4f815ae0aabf56d6504f.tar.xz platform-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.cpp | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp index 93e26093..6a638582 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp | |||
@@ -196,9 +196,29 @@ void ScreenRecoveryUI::draw_progress_locked() | |||
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | #define C_HEADER 247,0,6 | 199 | void ScreenRecoveryUI::SetColor(UIElement e) { |
200 | #define C_MENU 0,106,157 | 200 | switch (e) { |
201 | #define C_LOG 249,194,0 | 201 | case HEADER: |
202 | gr_color(247, 0, 6, 255); | ||
203 | break; | ||
204 | case MENU: | ||
205 | case MENU_SEL_BG: | ||
206 | gr_color(0, 106, 157, 255); | ||
207 | break; | ||
208 | case MENU_SEL_FG: | ||
209 | gr_color(255, 255, 255, 255); | ||
210 | break; | ||
211 | case LOG: | ||
212 | gr_color(249, 194, 0, 255); | ||
213 | break; | ||
214 | case TEXT_FILL: | ||
215 | gr_color(0, 0, 0, 160); | ||
216 | break; | ||
217 | default: | ||
218 | gr_color(255, 255, 255, 255); | ||
219 | break; | ||
220 | } | ||
221 | } | ||
202 | 222 | ||
203 | // Redraw everything on the screen. Does not flip pages. | 223 | // Redraw everything on the screen. Does not flip pages. |
204 | // Should only be called with updateMutex locked. | 224 | // Should only be called with updateMutex locked. |
@@ -208,37 +228,38 @@ void ScreenRecoveryUI::draw_screen_locked() | |||
208 | draw_progress_locked(); | 228 | draw_progress_locked(); |
209 | 229 | ||
210 | if (show_text) { | 230 | if (show_text) { |
211 | gr_color(0, 0, 0, 160); | 231 | SetColor(TEXT_FILL); |
212 | gr_fill(0, 0, gr_fb_width(), gr_fb_height()); | 232 | gr_fill(0, 0, gr_fb_width(), gr_fb_height()); |
213 | 233 | ||
214 | int y = 0; | 234 | int y = 0; |
215 | int i = 0; | 235 | int i = 0; |
216 | if (show_menu) { | 236 | if (show_menu) { |
217 | gr_color(C_HEADER, 255); | 237 | SetColor(HEADER); |
218 | 238 | ||
219 | for (; i < menu_top + menu_items; ++i) { | 239 | for (; i < menu_top + menu_items; ++i) { |
220 | if (i == menu_top) gr_color(C_MENU, 255); | 240 | if (i == menu_top) SetColor(MENU); |
221 | 241 | ||
222 | if (i == menu_top + menu_sel) { | 242 | if (i == menu_top + menu_sel) { |
223 | // draw the highlight bar | 243 | // draw the highlight bar |
244 | SetColor(MENU_SEL_BG); | ||
224 | gr_fill(0, y-2, gr_fb_width(), y+char_height+2); | 245 | gr_fill(0, y-2, gr_fb_width(), y+char_height+2); |
225 | // white text of selected item | 246 | // white text of selected item |
226 | gr_color(255, 255, 255, 255); | 247 | SetColor(MENU_SEL_FG); |
227 | if (menu[i][0]) gr_text(4, y, menu[i], 1); | 248 | if (menu[i][0]) gr_text(4, y, menu[i], 1); |
228 | gr_color(C_MENU, 255); | 249 | SetColor(MENU); |
229 | } else { | 250 | } else { |
230 | if (menu[i][0]) gr_text(4, y, menu[i], i < menu_top); | 251 | if (menu[i][0]) gr_text(4, y, menu[i], i < menu_top); |
231 | } | 252 | } |
232 | y += char_height+4; | 253 | y += char_height+4; |
233 | } | 254 | } |
234 | gr_color(C_MENU, 255); | 255 | SetColor(MENU); |
235 | y += 4; | 256 | y += 4; |
236 | gr_fill(0, y, gr_fb_width(), y+2); | 257 | gr_fill(0, y, gr_fb_width(), y+2); |
237 | y += 4; | 258 | y += 4; |
238 | ++i; | 259 | ++i; |
239 | } | 260 | } |
240 | 261 | ||
241 | gr_color(C_LOG, 255); | 262 | SetColor(LOG); |
242 | 263 | ||
243 | // display from the bottom up, until we hit the top of the | 264 | // display from the bottom up, until we hit the top of the |
244 | // screen, the bottom of the menu, or we've displayed the | 265 | // screen, the bottom of the menu, or we've displayed the |
@@ -585,3 +606,10 @@ void ScreenRecoveryUI::ShowText(bool visible) | |||
585 | update_screen_locked(); | 606 | update_screen_locked(); |
586 | pthread_mutex_unlock(&updateMutex); | 607 | pthread_mutex_unlock(&updateMutex); |
587 | } | 608 | } |
609 | |||
610 | void ScreenRecoveryUI::Redraw() | ||
611 | { | ||
612 | pthread_mutex_lock(&updateMutex); | ||
613 | update_screen_locked(); | ||
614 | pthread_mutex_unlock(&updateMutex); | ||
615 | } | ||