summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-06-30 06:16:27 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-06-30 06:16:27 +0200
commit3a0fbd46ab38317f4750414db6ae79bb6be376c0 (patch)
tree0db200dff1c11be5442d9a25600166640beb3821
parentMerge "wear_ui: Remove dead/duplicate codes." am: f722fcf0d4 am: c9e411858f (diff)
parentMerge "screen_ui: Compute the top and bottom gaps." am: 344778c4ef (diff)
downloadandroid_bootable_recovery-3a0fbd46ab38317f4750414db6ae79bb6be376c0.tar
android_bootable_recovery-3a0fbd46ab38317f4750414db6ae79bb6be376c0.tar.gz
android_bootable_recovery-3a0fbd46ab38317f4750414db6ae79bb6be376c0.tar.bz2
android_bootable_recovery-3a0fbd46ab38317f4750414db6ae79bb6be376c0.tar.lz
android_bootable_recovery-3a0fbd46ab38317f4750414db6ae79bb6be376c0.tar.xz
android_bootable_recovery-3a0fbd46ab38317f4750414db6ae79bb6be376c0.tar.zst
android_bootable_recovery-3a0fbd46ab38317f4750414db6ae79bb6be376c0.zip
-rw-r--r--screen_ui.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index bcfaaa4be..378a4514a 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -112,24 +112,24 @@ int ScreenRecoveryUI::PixelsFromDp(int dp) const {
// | portrait large landscape large
// ---------+-------------------------------------------------
-// gap | 220dp 366dp 142dp 284dp
+// gap |
// icon | (200dp)
// gap | 68dp 68dp 56dp 112dp
// text | (14sp)
// gap | 32dp 32dp 26dp 52dp
// progress | (2dp)
-// gap | 194dp 340dp 131dp 262dp
+// gap |
-// Note that "baseline" is actually the *top* of each icon (because that's how our drawing
-// routines work), so that's the more useful measurement for calling code.
+// Note that "baseline" is actually the *top* of each icon (because that's how our drawing routines
+// work), so that's the more useful measurement for calling code. We use even top and bottom gaps.
enum Layout { PORTRAIT = 0, PORTRAIT_LARGE = 1, LANDSCAPE = 2, LANDSCAPE_LARGE = 3, LAYOUT_MAX };
-enum Dimension { PROGRESS = 0, TEXT = 1, ICON = 2, DIMENSION_MAX };
+enum Dimension { TEXT = 0, ICON = 1, DIMENSION_MAX };
static constexpr int kLayouts[LAYOUT_MAX][DIMENSION_MAX] = {
- { 194, 32, 68, }, // PORTRAIT
- { 340, 32, 68, }, // PORTRAIT_LARGE
- { 131, 26, 56, }, // LANDSCAPE
- { 262, 52, 112, }, // LANDSCAPE_LARGE
+ { 32, 68, }, // PORTRAIT
+ { 32, 68, }, // PORTRAIT_LARGE
+ { 26, 56, }, // LANDSCAPE
+ { 52, 112, }, // LANDSCAPE_LARGE
};
int ScreenRecoveryUI::GetAnimationBaseline() const {
@@ -142,8 +142,11 @@ int ScreenRecoveryUI::GetTextBaseline() const {
}
int ScreenRecoveryUI::GetProgressBaseline() const {
- return gr_fb_height() - PixelsFromDp(kLayouts[layout_][PROGRESS]) -
- gr_get_height(progressBarFill);
+ int elements_sum = gr_get_height(loopFrames[0]) + PixelsFromDp(kLayouts[layout_][ICON]) +
+ gr_get_height(installing_text) + PixelsFromDp(kLayouts[layout_][TEXT]) +
+ gr_get_height(progressBarFill);
+ int bottom_gap = (gr_fb_height() - elements_sum) / 2;
+ return gr_fb_height() - bottom_gap - gr_get_height(progressBarFill);
}
// Clear the screen and draw the currently selected background icon (if any).