From 64e0a6525f6f82a67649602de3fe1ad62c837c27 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Wed, 25 Jul 2018 09:52:17 -0500 Subject: Use listbox for device-specific advanced menu items This patch allows items to have more than one action surrounded by the tags like other GUI elements. The patch also adds new twrp command line options that let you reload the theme and switch to a specific page from the command line: adb shell twrp reloadtheme adb shell twrp changepage=advanced Change-Id: I838ea380a508be07b9fa617034d1954e116febd6 --- gui/gui.cpp | 7 +++ gui/listbox.cpp | 4 +- gui/theme/common/landscape.xml | 87 ++++++++++++++-------------- gui/theme/common/portrait.xml | 94 +++++++++++++++--------------- gui/theme/common/watch.xml | 101 ++++++++++++++++++++++----------- gui/theme/portrait_hdpi/ui.xml | 1 + gui/theme/portrait_mdpi/ui.xml | 1 + gui/theme/watch_mdpi/images/handle.png | Bin 557 -> 412 bytes 8 files changed, 171 insertions(+), 124 deletions(-) diff --git a/gui/gui.cpp b/gui/gui.cpp index a270e365f..ce8c3e29d 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -474,6 +474,13 @@ static void ors_command_read() gui_set_FILE(orsout); PageManager::GetResources()->DumpStrings(); ors_command_done(); + } else if (strlen(command) == 11 && strncmp(command, "reloadtheme", 11) == 0) { + PageManager::RequestReload(); + ors_command_done(); + } else if (strlen(command) > 11 && strncmp(command, "changepage=", 11) == 0) { + char* pg = &command[11]; + gui_changePage(pg); + ors_command_done(); } else { // mirror output messages gui_set_FILE(orsout); diff --git a/gui/listbox.cpp b/gui/listbox.cpp index 9d36baed7..9fbe09234 100644 --- a/gui/listbox.cpp +++ b/gui/listbox.cpp @@ -102,8 +102,10 @@ GUIListBox::GUIListBox(xml_node<>* node) : GUIScrollList(node) item.selected = (child->value() == currentValue); item.action = NULL; xml_node<>* action = child->first_node("action"); + if (!action) + action = child->first_node("actions"); if (action) { - item.action = new GUIAction(action); + item.action = new GUIAction(child); allowSelection = true; } xml_node<>* variable_name = child->first_node("data"); diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml index 6df886256..a3e6ed82a 100755 --- a/gui/theme/common/landscape.xml +++ b/gui/theme/common/landscape.xml @@ -165,6 +165,16 @@ + + + + + +