From 89e2dcf83fa3901090893e98c17708e279dea47f Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Mon, 24 Nov 2014 15:11:41 -0800 Subject: recovery: Initial dialog implementation Implement two types of dialogs: info and error. Info dialogs are intended to show that an operation is in progress and cannot be interrupted. Error dialogs are intended to show that an error occurred. The user must respond by dismissing the dialog with any input (a swipe or keypress). Dialogs may be initiated internally within the UI code or externally via a named local socket. Dialogs created via socket are presumed to be info and may not be dismissed. When the client socket is closed, the dialog automatically dismisses. Initial implementation shows dialogs for adb backup and restore. Future work will show dialogs for all errors and lengthy operations. Change-Id: Icefea12ec0fd70fb487d54aa2eb1cae9dd451355 --- screen_ui.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'screen_ui.h') diff --git a/screen_ui.h b/screen_ui.h index 2ec5f5d..e198503 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -52,6 +52,12 @@ class ScreenRecoveryUI : public RecoveryUI { void PrintOnScreenOnly(const char* fmt, ...) __printflike(2, 3); void ShowFile(const char* filename); + void DialogShowInfo(const char* text); + void DialogShowError(const char* text); + int DialogShowing() const { return (dialog_text != NULL); } + bool DialogDismissable() const { return (dialog_icon == ERROR); } + void DialogDismiss(); + // menu display void StartMenu(const char* const * headers, const char* const * items, int initial_selection); @@ -63,7 +69,7 @@ class ScreenRecoveryUI : public RecoveryUI { void Redraw(); enum UIElement { - HEADER, MENU, MENU_SEL_BG, MENU_SEL_BG_ACTIVE, MENU_SEL_FG, LOG, TEXT_FILL, INFO + HEADER, MENU, MENU_SEL_BG, MENU_SEL_BG_ACTIVE, MENU_SEL_FG, LOG, TEXT_FILL, INFO, ERROR_TEXT }; void SetColor(UIElement e); @@ -74,8 +80,8 @@ class ScreenRecoveryUI : public RecoveryUI { bool rtl_locale; pthread_mutex_t updateMutex; - GRSurface* backgroundIcon[5]; - GRSurface* backgroundText[5]; + GRSurface* backgroundIcon[NR_ICONS]; + GRSurface* backgroundText[NR_ICONS]; GRSurface** installation; GRSurface* progressBarEmpty; GRSurface* progressBarFill; @@ -99,6 +105,9 @@ class ScreenRecoveryUI : public RecoveryUI { bool show_text; bool show_text_ever; // has show_text ever been true? + Icon dialog_icon; + char *dialog_text; + char** menu_; const char* const* menu_headers_; bool show_menu; @@ -121,6 +130,7 @@ class ScreenRecoveryUI : public RecoveryUI { void draw_background_locked(Icon icon); void draw_progress_locked(); + void draw_dialog(); void draw_screen_locked(); void update_screen_locked(); void update_progress_locked(); -- cgit v1.1