void LibraryPageComponent::buttonClicked(Button *button) { if (button == backButton) { getMainStack().popPage(PageStackComponent::kTransitionTranslateHorizontalLeft); } else if (button == prevPageBtn) { grid->showPrevPage(); checkShowPageNav(); } else if (button == nextPageBtn) { grid->showNextPage(); checkShowPageNav(); } else { // TODO: implement downloading here } }
void AppsPageComponent::buttonClicked(Button *button) { if (button == prevPageBtn) { grid->showPrevPage(); checkShowPageNav(); } else if (button == nextPageBtn) { grid->showNextPage(); checkShowPageNav(); } else if (button == appsLibraryBtn) { openAppsLibrary(); } else { auto appButton = (AppIconButton*)button; startOrFocusApp(appButton); } }
Array<DrawableButton *> AppsPageComponent::createIconsFromJsonArray(const var &json) { auto buttons = AppListComponent::createIconsFromJsonArray(json); //// hard coded "virtual" application. Cannot be removed. //appsLibraryBtn = createAndOwnIcon("App Get", "appIcons/update.png", String::empty); //buttons.add(appsLibraryBtn); checkShowPageNav(); return buttons; }
Array<DrawableButton *> AppListComponent::createIconsFromJsonArray(const var &json) { Array<DrawableButton *> buttons; if (json.isArray()) { for (const auto &item : *json.getArray()) { auto name = item["name"]; auto shell = item["shell"]; auto iconPath = item["icon"]; if (name.isString() && shell.isString() && iconPath.isString()) { auto icon = createAndOwnIcon(name, iconPath, shell); if (icon) { buttons.add(icon); } } } } checkShowPageNav(); return buttons; }