| 432 | } |
| 433 | |
| 434 | void ShowCustomApp(String name, FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x, int16_t y, GifPlayer *gifPlayer) |
| 435 | { |
| 436 | // Abort if notifyFlag is set |
| 437 | if (notifyFlag) |
| 438 | { |
| 439 | return; |
| 440 | } |
| 441 | |
| 442 | // Get custom App by ID |
| 443 | CustomApp *ca = getCustomAppByName(name); |
| 444 | |
| 445 | // Abort if custom App not found |
| 446 | if (ca == nullptr) |
| 447 | { |
| 448 | return; |
| 449 | } |
| 450 | |
| 451 | if (!DisplayManager.appIsSwitching) |
| 452 | { |
| 453 | if (ca->duration > 0) |
| 454 | { |
| 455 | DisplayManager.setAppTime(ca->duration); |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | DisplayManager.drawFilledRect(x, y, 32, 8, ca->background); |
| 460 | |
| 461 | if (ca->effect > -1) |
| 462 | { |
| 463 | callEffect(matrix, x, y, ca->effect); |
| 464 | } |
| 465 | |
| 466 | CURRENT_APP = ca->name; |
| 467 | currentCustomApp = name; |
| 468 | |
| 469 | if ((ca->iconName.length() > 0) && !ca->icon) |
| 470 | { |
| 471 | const char *extensions[] = {".jpg", ".gif"}; |
| 472 | bool isGifFlags[] = {false, true}; |
| 473 | |
| 474 | for (int i = 0; i < 2; i++) |
| 475 | { |
| 476 | String filePath = "/ICONS/" + ca->iconName + extensions[i]; |
| 477 | if (LittleFS.exists(filePath)) |
| 478 | { |
| 479 | ca->isGif = isGifFlags[i]; |
| 480 | ca->icon = LittleFS.open(filePath); |
| 481 | ca->currentFrame = 0; |
| 482 | break; |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | bool hasIcon = ca->icon || ca->jpegDataSize > 0; |
| 488 | |
| 489 | uint16_t textWidth = 0; |
| 490 | if (!ca->fragments.empty()) |
| 491 | { |
no test coverage detected