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

Method loop

src/activities/util/BmpViewerActivity.cpp:179–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179void BmpViewerActivity::loop() {
180 // Keep CPU awake/polling so 1st click works
181 Activity::loop();
182
183 if (mappedInput.wasReleased(MappedInputManager::Button::Back)) {
184 activityManager.goToFileBrowser(filePath);
185 return;
186 }
187
188 if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
189 doSetSleepCover();
190 return;
191 }
192
193 if (mappedInput.wasReleased(MappedInputManager::Button::Left) ||
194 mappedInput.wasReleased(MappedInputManager::Button::Up)) {
195 if (siblingImages.size() > 1 && currentImageIndex > 0) {
196 currentImageIndex--;
197 std::string dirPath = FsHelpers::extractFolderPath(filePath);
198 if (dirPath.back() != '/') dirPath += "/";
199 filePath = dirPath + siblingImages[currentImageIndex];
200 onEnter();
201 }
202 return;
203 }
204
205 if (mappedInput.wasReleased(MappedInputManager::Button::Right) ||
206 mappedInput.wasReleased(MappedInputManager::Button::Down)) {
207 if (siblingImages.size() > 1 && currentImageIndex != -1 &&
208 currentImageIndex < static_cast<int>(siblingImages.size()) - 1) {
209 currentImageIndex++;
210 std::string dirPath = FsHelpers::extractFolderPath(filePath);
211 if (dirPath.back() != '/') dirPath += "/";
212 filePath = dirPath + siblingImages[currentImageIndex];
213 onEnter();
214 }
215 return;
216 }
217}

Callers

nothing calls this directly

Calls 5

loopFunction · 0.85
extractFolderPathFunction · 0.85
goToFileBrowserMethod · 0.80
wasReleasedMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected