diff options
author | Tao Bao <tbao@google.com> | 2017-09-11 20:35:30 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-09-11 20:35:30 +0200 |
commit | 3616adceea7b9b241747a7aa76b8f5d945608ec1 (patch) | |
tree | a68b755a5d723a0609669c2f4933015db5610394 /screen_ui.h | |
parent | ui: Manage menu_ with std::vector. (diff) | |
parent | Merge "ui: Refactor the declaration orders." am: 79a23b30d2 (diff) | |
download | android_bootable_recovery-3616adceea7b9b241747a7aa76b8f5d945608ec1.tar android_bootable_recovery-3616adceea7b9b241747a7aa76b8f5d945608ec1.tar.gz android_bootable_recovery-3616adceea7b9b241747a7aa76b8f5d945608ec1.tar.bz2 android_bootable_recovery-3616adceea7b9b241747a7aa76b8f5d945608ec1.tar.lz android_bootable_recovery-3616adceea7b9b241747a7aa76b8f5d945608ec1.tar.xz android_bootable_recovery-3616adceea7b9b241747a7aa76b8f5d945608ec1.tar.zst android_bootable_recovery-3616adceea7b9b241747a7aa76b8f5d945608ec1.zip |
Diffstat (limited to 'screen_ui.h')
-rw-r--r-- | screen_ui.h | 103 |
1 files changed, 52 insertions, 51 deletions
diff --git a/screen_ui.h b/screen_ui.h index 8231a2ba0..9bbdbf5df 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -32,6 +32,17 @@ struct GRSurface; // (shows an icon + a progress bar, text logging, menu, etc.) class ScreenRecoveryUI : public RecoveryUI { public: + enum UIElement { + HEADER, + MENU, + MENU_SEL_BG, + MENU_SEL_BG_ACTIVE, + MENU_SEL_FG, + LOG, + TEXT_FILL, + INFO + }; + ScreenRecoveryUI(); bool Init(const std::string& locale) override; @@ -67,16 +78,6 @@ class ScreenRecoveryUI : public RecoveryUI { void Redraw(); - enum UIElement { - HEADER, - MENU, - MENU_SEL_BG, - MENU_SEL_BG_ACTIVE, - MENU_SEL_FG, - LOG, - TEXT_FILL, - INFO - }; void SetColor(UIElement e) const; protected: @@ -89,7 +90,47 @@ class ScreenRecoveryUI : public RecoveryUI { const int kAnimationFps; // The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi. - const float density_; + const float kDensity; + + virtual bool InitTextParams(); + + virtual void draw_background_locked(); + virtual void draw_foreground_locked(); + virtual void draw_screen_locked(); + virtual void update_screen_locked(); + virtual void update_progress_locked(); + + GRSurface* GetCurrentFrame() const; + GRSurface* GetCurrentText() const; + + static void* ProgressThreadStartRoutine(void* data); + void ProgressThreadLoop(); + + virtual void ShowFile(FILE*); + virtual void PrintV(const char*, bool, va_list); + void PutChar(char); + void ClearText(); + + void LoadAnimation(); + void LoadBitmap(const char* filename, GRSurface** surface); + void LoadLocalizedBitmap(const char* filename, GRSurface** surface); + + int PixelsFromDp(int dp) const; + virtual int GetAnimationBaseline() const; + virtual int GetProgressBaseline() const; + virtual int GetTextBaseline() const; + + // Draws a highlight bar at (x, y) - (x + width, y + height). + virtual void DrawHighlightBar(int x, int y, int width, int height) const; + // Draws a horizontal rule at Y. Returns the offset it should be moving along Y-axis. + virtual int DrawHorizontalRule(int y) const; + // Draws a line of text. Returns the offset it should be moving along Y-axis. + virtual int DrawTextLine(int x, int y, const char* line, bool bold) const; + // Draws multiple text lines. Returns the offset it should be moving along Y-axis. + int DrawTextLines(int x, int y, const char* const* lines) const; + // Similar to DrawTextLines() to draw multiple text lines, but additionally wraps long lines. + // Returns the offset it should be moving along Y-axis. + int DrawWrappedTextLines(int x, int y, const char* const* lines) const; Icon currentIcon; @@ -151,46 +192,6 @@ class ScreenRecoveryUI : public RecoveryUI { int char_height_; pthread_mutex_t updateMutex; - - virtual bool InitTextParams(); - - virtual void draw_background_locked(); - virtual void draw_foreground_locked(); - virtual void draw_screen_locked(); - virtual void update_screen_locked(); - virtual void update_progress_locked(); - - GRSurface* GetCurrentFrame() const; - GRSurface* GetCurrentText() const; - - static void* ProgressThreadStartRoutine(void* data); - void ProgressThreadLoop(); - - virtual void ShowFile(FILE*); - virtual void PrintV(const char*, bool, va_list); - void PutChar(char); - void ClearText(); - - void LoadAnimation(); - void LoadBitmap(const char* filename, GRSurface** surface); - void LoadLocalizedBitmap(const char* filename, GRSurface** surface); - - int PixelsFromDp(int dp) const; - virtual int GetAnimationBaseline() const; - virtual int GetProgressBaseline() const; - virtual int GetTextBaseline() const; - - // Draws a highlight bar at (x, y) - (x + width, y + height). - virtual void DrawHighlightBar(int x, int y, int width, int height) const; - // Draws a horizontal rule at Y. Returns the offset it should be moving along Y-axis. - virtual int DrawHorizontalRule(int y) const; - // Draws a line of text. Returns the offset it should be moving along Y-axis. - virtual int DrawTextLine(int x, int y, const char* line, bool bold) const; - // Draws multiple text lines. Returns the offset it should be moving along Y-axis. - int DrawTextLines(int x, int y, const char* const* lines) const; - // Similar to DrawTextLines() to draw multiple text lines, but additionally wraps long lines. - // Returns the offset it should be moving along Y-axis. - int DrawWrappedTextLines(int x, int y, const char* const* lines) const; }; #endif // RECOVERY_UI_H |