From 22d36ae1a1fc4c540f308ead224509613425f511 Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Fri, 10 Apr 2015 17:11:03 +0200 Subject: 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 --- screen_ui.cpp | 15 ++++++++++----- 1 file 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; -- cgit v1.1