aboutsummaryrefslogtreecommitdiffstats
path: root/screen_ui.h
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2014-11-24 15:11:41 -0800
committerTom Marshall <tdm@cyngn.com>2015-11-25 15:35:20 -0800
commit89e2dcf83fa3901090893e98c17708e279dea47f (patch)
tree23a69ea49d0897fc5052ef44f75afc9a7f53c89a /screen_ui.h
parentacc855f711ae7bce20e4fc896c829e135a6801fc (diff)
downloadbootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.zip
bootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.tar.gz
bootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.tar.bz2
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
Diffstat (limited to 'screen_ui.h')
-rw-r--r--screen_ui.h16
1 files changed, 13 insertions, 3 deletions
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();