summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2015-04-10 17:11:03 +0200
committerTom Marshall <tdm@cyngn.com>2015-11-25 15:35:47 -0800
commit22d36ae1a1fc4c540f308ead224509613425f511 (patch)
tree6e401a6dbd9ddeabe30aab4e2f8e324c900f3af6
parent0b0db7d064349f483635f577ebc70ad2df479f8c (diff)
downloadbootable_recovery-22d36ae1a1fc4c540f308ead224509613425f511.zip
bootable_recovery-22d36ae1a1fc4c540f308ead224509613425f511.tar.gz
bootable_recovery-22d36ae1a1fc4c540f308ead224509613425f511.tar.bz2
Improve placement of progress bar.
Limit text output to 1/4 of screen height during installation, and center icon and progress bar inside the remaining space. Change-Id: I4b56db78d13931fdd79580b801260bdfca0e9726
-rw-r--r--screen_ui.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index f87e298..b37c168 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -109,14 +109,16 @@ void ScreenRecoveryUI::draw_background_locked(Icon icon) {
int textWidth = gr_get_width(text_surface);
int textHeight = gr_get_height(text_surface);
int stageHeight = gr_get_height(stageMarkerEmpty);
+ int availableHeight = icon == INSTALLING_UPDATE && !DialogShowing() && show_text
+ ? 3 * gr_fb_height() / 4 : gr_fb_height();
int sh = (max_stage >= 0) ? stageHeight : 0;
iconX = (gr_fb_width() - iconWidth) / 2;
- iconY = (gr_fb_height() - (iconHeight+textHeight+40+sh)) / 2;
+ iconY = (availableHeight - (iconHeight+textHeight+40+sh)) / 2;
int textX = (gr_fb_width() - textWidth) / 2;
- int textY = ((gr_fb_height() - (iconHeight+textHeight+40+sh)) / 2) + iconHeight + 40;
+ int textY = ((availableHeight - (iconHeight+textHeight+40+sh)) / 2) + iconHeight + 40;
gr_blit(surface, 0, 0, iconWidth, iconHeight, iconX, iconY);
if (stageHeight > 0) {
@@ -152,8 +154,11 @@ void ScreenRecoveryUI::draw_progress_locked() {
int width = gr_get_width(progressBarEmpty);
int height = gr_get_height(progressBarEmpty);
- int dx = (gr_fb_width() - width)/2;
- int dy = (gr_fb_height() / 2) + (iconHeight / 2);
+ int bottomOfUsableHeight = show_text ? 3 * gr_fb_height() / 4 : gr_fb_height();
+ int bottomOfIcon = bottomOfUsableHeight / 2 + iconHeight / 2;
+
+ int dx = (gr_fb_width() - width) / 2;
+ int dy = bottomOfIcon + (bottomOfUsableHeight - bottomOfIcon) / 2 - height / 2;
// Erase behind the progress bar (in case this was a progress-only update)
gr_color(0, 0, 0, 255);
@@ -344,7 +349,7 @@ void ScreenRecoveryUI::draw_screen_locked() {
if (show_text) {
if (currentIcon == ERASING || currentIcon == INSTALLING_UPDATE || currentIcon == VIEWING_LOG) {
- size_t y = header_height_ + 4;
+ size_t y = currentIcon == INSTALLING_UPDATE ? gr_fb_height() / 4 : header_height_ + 4;
SetColor(LOG);
int cx, cy;