mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 22:57:50 +03:00
fix(extensions): support left/right navigation in Apps menu
This commit is contained in:
parent
eedc856708
commit
f611cc9615
@ -1,12 +1,12 @@
|
||||
#include "AppsActivity.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <EInkDisplay.h>
|
||||
#include <GfxRenderer.h>
|
||||
#include <InputManager.h>
|
||||
#include <MappedInputManager.h>
|
||||
#include <SDCardManager.h>
|
||||
#include <fontIds.h>
|
||||
#include <GfxRenderer.h>
|
||||
#include <MappedInputManager.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
AppsActivity::AppsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, ExitCallback exitCallback)
|
||||
: Activity("Apps", renderer, mappedInput),
|
||||
@ -24,21 +24,21 @@ void AppsActivity::onEnter() {
|
||||
needsUpdate_ = true;
|
||||
}
|
||||
|
||||
void AppsActivity::onExit() {
|
||||
Activity::onExit();
|
||||
}
|
||||
void AppsActivity::onExit() { Activity::onExit(); }
|
||||
|
||||
void AppsActivity::loop() {
|
||||
if (isFlashing_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mappedInput_.wasPressed(MappedInputManager::Button::Up)) {
|
||||
if (mappedInput_.wasPressed(MappedInputManager::Button::Up) ||
|
||||
mappedInput_.wasPressed(MappedInputManager::Button::Left)) {
|
||||
if (selectedIndex_ > 0) {
|
||||
selectedIndex_--;
|
||||
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) {
|
||||
selectedIndex_++;
|
||||
needsUpdate_ = true;
|
||||
@ -155,8 +155,8 @@ void AppsActivity::render() {
|
||||
// Button hints
|
||||
const char* btn1 = "Back";
|
||||
const char* btn2 = appList_.empty() ? "" : "Launch";
|
||||
const char* btn3 = "Up";
|
||||
const char* btn4 = "Down";
|
||||
const char* btn3 = "<";
|
||||
const char* btn4 = ">";
|
||||
|
||||
auto labels = mappedInput_.mapLabels(btn1, btn2, btn3, btn4);
|
||||
renderer_.drawButtonHints(UI_10_FONT_ID, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user