MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / loop

Method loop

src/activities/util/KeyboardEntryActivity.cpp:191–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191void KeyboardEntryActivity::loop() {
192 const int totalRows = getTotalRowCount();
193
194 if (!cursorMode && mappedInput.wasPressed(MappedInputManager::Button::Up)) {
195 upHeld = true;
196 upLongHandled = false;
197 }
198
199 if (upHeld && !upLongHandled && mappedInput.isPressed(MappedInputManager::Button::Up) &&
200 mappedInput.getHeldTime() > LONG_PRESS_MS) {
201 cursorMode = true;
202 upLongHandled = true;
203 hintVisible = true;
204 hintShowTime = millis();
205 requestUpdate();
206 }
207
208 if (mappedInput.wasReleased(MappedInputManager::Button::Up)) {
209 if (upHeld && !upLongHandled && !cursorMode) {
210 bool wasBottom = isBottomRow(selectedRow);
211 const int contentCols = getContentColCount();
212 selectedRow = ButtonNavigator::previousIndex(selectedRow, totalRows);
213 if (wasBottom && !isBottomRow(selectedRow)) {
214 mapColContentBottom(selectedCol, true);
215 } else if (!wasBottom && isBottomRow(selectedRow)) {
216 mapColContentBottom(selectedCol, false);
217 }
218 int maxCol = isBottomRow(selectedRow) ? BOTTOM_KEY_COUNT - 1 : contentCols - 1;
219 if (selectedCol > maxCol) selectedCol = maxCol;
220 requestUpdate();
221 }
222 upHeld = false;
223 upLongHandled = false;
224 }
225
226 if (mappedInput.wasPressed(MappedInputManager::Button::Down)) {
227 downHeld = true;
228 if (cursorMode) {
229 togglePos = false;
230 passwordVisible = false;
231 cursorMode = false;
232 hintVisible = false;
233 downLongHandled = true;
234 requestUpdate();
235 } else {
236 downLongHandled = false;
237 }
238 }
239
240 if (mappedInput.wasReleased(MappedInputManager::Button::Down)) {
241 if (downHeld && !downLongHandled && !cursorMode) {
242 bool wasBottom = isBottomRow(selectedRow);
243 const int contentCols = getContentColCount();
244 selectedRow = ButtonNavigator::nextIndex(selectedRow, totalRows);
245 if (wasBottom && !isBottomRow(selectedRow)) {
246 mapColContentBottom(selectedCol, true);
247 } else if (!wasBottom && isBottomRow(selectedRow)) {
248 mapColContentBottom(selectedCol, false);

Callers

nothing calls this directly

Calls 6

onPressAndContinuousMethod · 0.80
wasPressedMethod · 0.45
isPressedMethod · 0.45
getHeldTimeMethod · 0.45
wasReleasedMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected