| 177 | } |
| 178 | |
| 179 | void 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 | } |
nothing calls this directly
no test coverage detected