aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-09-10 13:28:32 -0500
committerTao Bao2017-09-10 13:36:54 -0500
commit7577965ba12ec2ea0df2e523cf335c9c8e5cfd16 (patch)
treed14fe469b75e23f3b3abf048b0628f151b5624ef /screen_ui.h
parentfa4f0140637ea2d2c24e9d8739ab3a573fbd22fe (diff)
downloadplatform-bootable-recovery-7577965ba12ec2ea0df2e523cf335c9c8e5cfd16.tar.gz
platform-bootable-recovery-7577965ba12ec2ea0df2e523cf335c9c8e5cfd16.tar.xz
platform-bootable-recovery-7577965ba12ec2ea0df2e523cf335c9c8e5cfd16.zip
ui: Refactor the declaration orders.
By grouping similar kinds together, in an order of types, constants, ctor/dtor, all other methods and data members. Also rename ScreenRecoveryUI::density_ to ScreenRecoveryUI::kDensity to align with others. Test: mmma bootable/recovery Change-Id: I1ba2d15c05ba7be8c39762f3d9dadf1fb2130de4
Diffstat (limited to 'screen_ui.h')
-rw-r--r--screen_ui.h103
1 files changed, 52 insertions, 51 deletions
diff --git a/screen_ui.h b/screen_ui.h
index 8231a2ba..9bbdbf5d 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -32,6 +32,17 @@ struct GRSurface;
32// (shows an icon + a progress bar, text logging, menu, etc.) 32// (shows an icon + a progress bar, text logging, menu, etc.)
33class ScreenRecoveryUI : public RecoveryUI { 33class ScreenRecoveryUI : public RecoveryUI {
34 public: 34 public:
35 enum UIElement {
36 HEADER,
37 MENU,
38 MENU_SEL_BG,
39 MENU_SEL_BG_ACTIVE,
40 MENU_SEL_FG,
41 LOG,
42 TEXT_FILL,
43 INFO
44 };
45
35 ScreenRecoveryUI(); 46 ScreenRecoveryUI();
36 47
37 bool Init(const std::string& locale) override; 48 bool Init(const std::string& locale) override;
@@ -67,16 +78,6 @@ class ScreenRecoveryUI : public RecoveryUI {
67 78
68 void Redraw(); 79 void Redraw();
69 80
70 enum UIElement {
71 HEADER,
72 MENU,
73 MENU_SEL_BG,
74 MENU_SEL_BG_ACTIVE,
75 MENU_SEL_FG,
76 LOG,
77 TEXT_FILL,
78 INFO
79 };
80 void SetColor(UIElement e) const; 81 void SetColor(UIElement e) const;
81 82
82 protected: 83 protected:
@@ -89,7 +90,47 @@ class ScreenRecoveryUI : public RecoveryUI {
89 const int kAnimationFps; 90 const int kAnimationFps;
90 91
91 // The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi. 92 // The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi.
92 const float density_; 93 const float kDensity;
94
95 virtual bool InitTextParams();
96
97 virtual void draw_background_locked();
98 virtual void draw_foreground_locked();
99 virtual void draw_screen_locked();
100 virtual void update_screen_locked();
101 virtual void update_progress_locked();
102
103 GRSurface* GetCurrentFrame() const;
104 GRSurface* GetCurrentText() const;
105
106 static void* ProgressThreadStartRoutine(void* data);
107 void ProgressThreadLoop();
108
109 virtual void ShowFile(FILE*);
110 virtual void PrintV(const char*, bool, va_list);
111 void PutChar(char);
112 void ClearText();
113
114 void LoadAnimation();
115 void LoadBitmap(const char* filename, GRSurface** surface);
116 void LoadLocalizedBitmap(const char* filename, GRSurface** surface);
117
118 int PixelsFromDp(int dp) const;
119 virtual int GetAnimationBaseline() const;
120 virtual int GetProgressBaseline() const;
121 virtual int GetTextBaseline() const;
122
123 // Draws a highlight bar at (x, y) - (x + width, y + height).
124 virtual void DrawHighlightBar(int x, int y, int width, int height) const;
125 // Draws a horizontal rule at Y. Returns the offset it should be moving along Y-axis.
126 virtual int DrawHorizontalRule(int y) const;
127 // Draws a line of text. Returns the offset it should be moving along Y-axis.
128 virtual int DrawTextLine(int x, int y, const char* line, bool bold) const;
129 // Draws multiple text lines. Returns the offset it should be moving along Y-axis.
130 int DrawTextLines(int x, int y, const char* const* lines) const;
131 // Similar to DrawTextLines() to draw multiple text lines, but additionally wraps long lines.
132 // Returns the offset it should be moving along Y-axis.
133 int DrawWrappedTextLines(int x, int y, const char* const* lines) const;
93 134
94 Icon currentIcon; 135 Icon currentIcon;
95 136
@@ -151,46 +192,6 @@ class ScreenRecoveryUI : public RecoveryUI {
151 int char_height_; 192 int char_height_;
152 193
153 pthread_mutex_t updateMutex; 194 pthread_mutex_t updateMutex;
154
155 virtual bool InitTextParams();
156
157 virtual void draw_background_locked();
158 virtual void draw_foreground_locked();
159 virtual void draw_screen_locked();
160 virtual void update_screen_locked();
161 virtual void update_progress_locked();
162
163 GRSurface* GetCurrentFrame() const;
164 GRSurface* GetCurrentText() const;
165
166 static void* ProgressThreadStartRoutine(void* data);
167 void ProgressThreadLoop();
168
169 virtual void ShowFile(FILE*);
170 virtual void PrintV(const char*, bool, va_list);
171 void PutChar(char);
172 void ClearText();
173
174 void LoadAnimation();
175 void LoadBitmap(const char* filename, GRSurface** surface);
176 void LoadLocalizedBitmap(const char* filename, GRSurface** surface);
177
178 int PixelsFromDp(int dp) const;
179 virtual int GetAnimationBaseline() const;
180 virtual int GetProgressBaseline() const;
181 virtual int GetTextBaseline() const;
182
183 // Draws a highlight bar at (x, y) - (x + width, y + height).
184 virtual void DrawHighlightBar(int x, int y, int width, int height) const;
185 // Draws a horizontal rule at Y. Returns the offset it should be moving along Y-axis.
186 virtual int DrawHorizontalRule(int y) const;
187 // Draws a line of text. Returns the offset it should be moving along Y-axis.
188 virtual int DrawTextLine(int x, int y, const char* line, bool bold) const;
189 // Draws multiple text lines. Returns the offset it should be moving along Y-axis.
190 int DrawTextLines(int x, int y, const char* const* lines) const;
191 // Similar to DrawTextLines() to draw multiple text lines, but additionally wraps long lines.
192 // Returns the offset it should be moving along Y-axis.
193 int DrawWrappedTextLines(int x, int y, const char* const* lines) const;
194}; 195};
195 196
196#endif // RECOVERY_UI_H 197#endif // RECOVERY_UI_H