fix(extensions): support left/right navigation in Apps menu

This commit is contained in:
Daniel 2026-02-03 22:46:38 -08:00
parent eedc856708
commit f611cc9615

View File

@ -1,12 +1,12 @@
#include "AppsActivity.h" #include "AppsActivity.h"
#include <Arduino.h>
#include <EInkDisplay.h> #include <EInkDisplay.h>
#include <GfxRenderer.h>
#include <InputManager.h> #include <InputManager.h>
#include <MappedInputManager.h>
#include <SDCardManager.h> #include <SDCardManager.h>
#include <fontIds.h> #include <fontIds.h>
#include <GfxRenderer.h>
#include <MappedInputManager.h>
#include <Arduino.h>
AppsActivity::AppsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, ExitCallback exitCallback) AppsActivity::AppsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, ExitCallback exitCallback)
: Activity("Apps", renderer, mappedInput), : Activity("Apps", renderer, mappedInput),
@ -24,21 +24,21 @@ void AppsActivity::onEnter() {
needsUpdate_ = true; needsUpdate_ = true;
} }
void AppsActivity::onExit() { void AppsActivity::onExit() { Activity::onExit(); }
Activity::onExit();
}
void AppsActivity::loop() { void AppsActivity::loop() {
if (isFlashing_) { if (isFlashing_) {
return; return;
} }
if (mappedInput_.wasPressed(MappedInputManager::Button::Up)) { if (mappedInput_.wasPressed(MappedInputManager::Button::Up) ||
mappedInput_.wasPressed(MappedInputManager::Button::Left)) {
if (selectedIndex_ > 0) { if (selectedIndex_ > 0) {
selectedIndex_--; selectedIndex_--;
needsUpdate_ = true; needsUpdate_ = true;
} }
} else if (mappedInput_.wasPressed(MappedInputManager::Button::Down)) { } else if (mappedInput_.wasPressed(MappedInputManager::Button::Down) ||
mappedInput_.wasPressed(MappedInputManager::Button::Right)) {
if (selectedIndex_ < static_cast<int>(appList_.size()) - 1) { if (selectedIndex_ < static_cast<int>(appList_.size()) - 1) {
selectedIndex_++; selectedIndex_++;
needsUpdate_ = true; needsUpdate_ = true;
@ -155,8 +155,8 @@ void AppsActivity::render() {
// Button hints // Button hints
const char* btn1 = "Back"; const char* btn1 = "Back";
const char* btn2 = appList_.empty() ? "" : "Launch"; const char* btn2 = appList_.empty() ? "" : "Launch";
const char* btn3 = "Up"; const char* btn3 = "<";
const char* btn4 = "Down"; const char* btn4 = ">";
auto labels = mappedInput_.mapLabels(btn1, btn2, btn3, btn4); auto labels = mappedInput_.mapLabels(btn1, btn2, btn3, btn4);
renderer_.drawButtonHints(UI_10_FONT_ID, labels.btn1, labels.btn2, labels.btn3, labels.btn4); renderer_.drawButtonHints(UI_10_FONT_ID, labels.btn1, labels.btn2, labels.btn3, labels.btn4);