diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 09de8d9a..f96a4464 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -1225,14 +1225,24 @@ static void lastHeardToggleContact() { return 0; } - // Notes editing: tap → open keyboard for typing + // Notes screen: mode-dependent touch if (ui_task.isOnNotesScreen()) { NotesScreen* notes = (NotesScreen*)ui_task.getNotesScreen(); - if (notes && notes->isEditing()) { + if (notes) { + if (notes->isInFileList()) { + int result = notes->selectRowAtVY(vy); + if (result == 1) { ui_task.forceRefresh(); return 0; } // Moved selection + if (result == 2) return KEY_ENTER; // Same row — open + return 0; + } + if (notes->isEditing()) { #if defined(LilyGo_T5S3_EPaper_Pro) - ui_task.showVirtualKeyboard(VKB_NOTES, "Edit Note", "", 137); + ui_task.showVirtualKeyboard(VKB_NOTES, "Edit Note", "", 137); #endif - return 0; // T-Deck Pro: keyboard handles typing directly + return 0; // T-Deck Pro: keyboard handles typing directly + } + // READING, RENAMING, CONFIRM_DELETE: tap = confirm/enter + return KEY_ENTER; } } diff --git a/examples/companion_radio/ui-new/Notesscreen.h b/examples/companion_radio/ui-new/Notesscreen.h index 15e5d903..74f1ceb1 100644 --- a/examples/companion_radio/ui-new/Notesscreen.h +++ b/examples/companion_radio/ui-new/Notesscreen.h @@ -1220,6 +1220,35 @@ public: bool isConfirmingDelete() const { return _mode == CONFIRM_DELETE; } bool isEmpty() const { return _bufLen == 0; } + // Touch: select file list row by virtual Y coordinate + // Returns: 0 = outside list, 1 = moved selection, 2 = tapped same row (open) + int selectRowAtVY(int vy) { + if (_mode != FILE_LIST) return 0; + const int startY = 14, footerH = 14; + const int listLineH = _prefs ? _prefs->smallLineH() : 9; +#if defined(LilyGo_T5S3_EPaper_Pro) + const int bodyTop = startY; +#else + const int bodyTop = startY + (_prefs ? _prefs->smallHighlightOff() : 5); +#endif + if (vy < bodyTop || vy >= 128 - footerH) return 0; + + int totalItems = 1 + (int)_fileList.size(); + if (totalItems == 0) return 0; + int maxVisible = (128 - startY - footerH) / listLineH; + if (maxVisible < 3) maxVisible = 3; + if (maxVisible > 15) maxVisible = 15; + int startIdx = max(0, min(_selectedFile - maxVisible / 2, + totalItems - maxVisible)); + + int tappedRow = startIdx + (vy - bodyTop) / listLineH; + if (tappedRow < 0 || tappedRow >= totalItems) return 0; + + if (tappedRow == _selectedFile) return 2; + _selectedFile = tappedRow; + return 1; + } + // ---- Cursor Navigation (called from main.cpp) ---- void moveCursorLeft() {