Add touch-down and long-press input detection
Implement touch-down event detection to provide immediate visual feedback when touching list items, mirroring button navigation behavior. Add long-press detection (500ms threshold) to distinguish between tap and hold gestures. Apply touch-down selection updates to file browser, home menu, and recent books activities.
This commit is contained in:
@@ -206,6 +206,14 @@ void FileBrowserActivity::loop() {
|
||||
const int pathReserved = renderer.getLineHeight(SMALL_FONT_ID) + UITheme::getInstance().getMetrics().verticalSpacing;
|
||||
const int pageItems = UITheme::getNumberOfItemsPerPage(renderer, true, false, true, false, pathReserved);
|
||||
|
||||
// Touch-down moves the selector to the pressed entry (shows selected state); release
|
||||
// opens it below.
|
||||
int downId = -1;
|
||||
if (mappedInput.wasItemTouchedDown(downId) && downId >= 0 && downId < static_cast<int>(files.size())) {
|
||||
selectorIndex = downId;
|
||||
requestUpdate();
|
||||
}
|
||||
|
||||
// A tap opens the tapped entry (held-time is 0 on a tap, so it takes the short-press
|
||||
// open path below, never the long-press delete).
|
||||
int tappedId = -1;
|
||||
|
||||
@@ -183,6 +183,14 @@ void HomeActivity::loop() {
|
||||
// menu-local ids (it is drawn with selectorIndex offset by recentBooks.size()),
|
||||
// so map the tapped id back into the global selector space. (The recent-book
|
||||
// cover is a separate, single-item draw path — tappable in a later phase.)
|
||||
// Touch-down moves the selector to the pressed menu button (shows selected state),
|
||||
// like Up/Down; release opens it below.
|
||||
int downId = -1;
|
||||
if (mappedInput.wasItemTouchedDown(downId)) {
|
||||
selectorIndex = static_cast<int>(recentBooks.size()) + downId;
|
||||
requestUpdate();
|
||||
}
|
||||
|
||||
int tappedId = -1;
|
||||
const bool tapped = mappedInput.wasItemTapped(tappedId);
|
||||
if (tapped) {
|
||||
|
||||
@@ -63,6 +63,12 @@ void RecentBooksActivity::loop() {
|
||||
return;
|
||||
}
|
||||
|
||||
int downId = -1;
|
||||
if (mappedInput.wasItemTouchedDown(downId) && downId >= 0 && downId < static_cast<int>(recentBooks.size())) {
|
||||
selectorIndex = downId;
|
||||
requestUpdate();
|
||||
}
|
||||
|
||||
int tappedId = -1;
|
||||
const bool tapped = mappedInput.wasItemTapped(tappedId);
|
||||
if (tapped && tappedId >= 0 && tappedId < static_cast<int>(recentBooks.size())) selectorIndex = tappedId;
|
||||
|
||||
Reference in New Issue
Block a user