Merge "Create a new function to return the help message for menu"
This commit is contained in:
@@ -286,6 +286,9 @@ class ScreenRecoveryUI : public RecoveryUI, public DrawInterface {
|
|||||||
// selected.
|
// selected.
|
||||||
virtual int SelectMenu(int sel);
|
virtual int SelectMenu(int sel);
|
||||||
|
|
||||||
|
// Returns the help message displayed on top of the menu.
|
||||||
|
virtual std::vector<std::string> GetMenuHelpMessage() const;
|
||||||
|
|
||||||
virtual void draw_background_locked();
|
virtual void draw_background_locked();
|
||||||
virtual void draw_foreground_locked();
|
virtual void draw_foreground_locked();
|
||||||
virtual void draw_screen_locked();
|
virtual void draw_screen_locked();
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class RecoveryUI {
|
|||||||
|
|
||||||
// Returns true if you have the volume up/down and power trio typical of phones and tablets, false
|
// Returns true if you have the volume up/down and power trio typical of phones and tablets, false
|
||||||
// otherwise.
|
// otherwise.
|
||||||
virtual bool HasThreeButtons();
|
virtual bool HasThreeButtons() const;
|
||||||
|
|
||||||
// Returns true if it has a power key.
|
// Returns true if it has a power key.
|
||||||
virtual bool HasPowerKey() const;
|
virtual bool HasPowerKey() const;
|
||||||
|
|||||||
@@ -673,6 +673,19 @@ void ScreenRecoveryUI::SetTitle(const std::vector<std::string>& lines) {
|
|||||||
title_lines_ = lines;
|
title_lines_ = lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> ScreenRecoveryUI::GetMenuHelpMessage() const {
|
||||||
|
// clang-format off
|
||||||
|
static std::vector<std::string> REGULAR_HELP{
|
||||||
|
"Use volume up/down and power.",
|
||||||
|
};
|
||||||
|
static std::vector<std::string> 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
|
// Redraws everything on the screen. Does not flip pages. Should only be called with updateMutex
|
||||||
// locked.
|
// locked.
|
||||||
void ScreenRecoveryUI::draw_screen_locked() {
|
void ScreenRecoveryUI::draw_screen_locked() {
|
||||||
@@ -685,16 +698,7 @@ void ScreenRecoveryUI::draw_screen_locked() {
|
|||||||
gr_color(0, 0, 0, 255);
|
gr_color(0, 0, 0, 255);
|
||||||
gr_clear();
|
gr_clear();
|
||||||
|
|
||||||
// clang-format off
|
draw_menu_and_text_buffer_locked(GetMenuHelpMessage());
|
||||||
static std::vector<std::string> REGULAR_HELP{
|
|
||||||
"Use volume up/down and power.",
|
|
||||||
};
|
|
||||||
static std::vector<std::string> 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draws the menu and text buffer on the screen. Should only be called with updateMutex locked.
|
// Draws the menu and text buffer on the screen. Should only be called with updateMutex locked.
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ bool RecoveryUI::IsLongPress() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RecoveryUI::HasThreeButtons() {
|
bool RecoveryUI::HasThreeButtons() const {
|
||||||
return has_power_key && has_up_key && has_down_key;
|
return has_power_key && has_up_key && has_down_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user