From 65d2f263f21154db3e88a72f36dd48faba1d71ec Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 17 May 2016 10:29:49 -0700 Subject: [PATCH] Center modal view message. --- firmware/application/ui_navigation.cpp | 6 ++++++ firmware/application/ui_navigation.hpp | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 3841cb979..bb554d05c 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -309,6 +309,12 @@ ModalMessageView::ModalMessageView( } }); text_message.set(message); + + const int text_message_width = message.size() * 8; + text_message.set_parent_rect({ + (240 - text_message_width) / 2, 7 * 16, + text_message_width, 16 + }); } void ModalMessageView::focus() { diff --git a/firmware/application/ui_navigation.hpp b/firmware/application/ui_navigation.hpp index b53a237cf..65fcf2fe8 100644 --- a/firmware/application/ui_navigation.hpp +++ b/firmware/application/ui_navigation.hpp @@ -223,10 +223,7 @@ public: private: const std::string title_; - Text text_message { - { 0 * 8, 7 * 16, 30 * 8, 16 }, - "" - }; + Text text_message { }; Button button_done { { 10 * 8, 13 * 16, 10 * 8, 24 },