From e5032219fe909864233e8225ee4fabd10c49ed5b Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Tue, 23 Jul 2019 13:23:29 -0700 Subject: Create a new function to return the help message for menu Then we can override this function in the device specific recovery ui; and allow customizing the help message. Bug: 137965958 Test: Check the menu on sailfish Change-Id: I09f23166f4205c5edf6c62eb42c8ada0fa710b26 --- recovery_ui/screen_ui.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'recovery_ui/screen_ui.cpp') diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp index f2af66c45..087fc0e84 100644 --- a/recovery_ui/screen_ui.cpp +++ b/recovery_ui/screen_ui.cpp @@ -673,6 +673,19 @@ void ScreenRecoveryUI::SetTitle(const std::vector& lines) { title_lines_ = lines; } +std::vector ScreenRecoveryUI::GetMenuHelpMessage() const { + // clang-format off + static std::vector REGULAR_HELP{ + "Use volume up/down and power.", + }; + static std::vector LONG_PRESS_HELP{ + "Any button cycles highlight.", + "Long-press activates.", + }; + // clang-format on + return HasThreeButtons() ? REGULAR_HELP : LONG_PRESS_HELP; +} + // Redraws everything on the screen. Does not flip pages. Should only be called with updateMutex // locked. void ScreenRecoveryUI::draw_screen_locked() { @@ -685,16 +698,7 @@ void ScreenRecoveryUI::draw_screen_locked() { gr_color(0, 0, 0, 255); gr_clear(); - // clang-format off - static std::vector REGULAR_HELP{ - "Use volume up/down and power.", - }; - static std::vector LONG_PRESS_HELP{ - "Any button cycles highlight.", - "Long-press activates.", - }; - // clang-format on - draw_menu_and_text_buffer_locked(HasThreeButtons() ? REGULAR_HELP : LONG_PRESS_HELP); + draw_menu_and_text_buffer_locked(GetMenuHelpMessage()); } // Draws the menu and text buffer on the screen. Should only be called with updateMutex locked. -- cgit v1.2.3