private String initializeInstallPrompt(PwaConfiguration pwaConfiguration) { PwaIcon largest = getIcons().stream().filter(PwaIcon::shouldBeCached) .min((icon1, icon2) -> icon2.getWidth() - icon1.getWidth()) .orElse(null); return BootstrapHandler.readResource("default-pwa-prompt.html") .replace("%%%INSTALL%%%", "Install") .replace("%%%LOGO_PATH%%%", largest == null ? "" : pwaConfiguration.getRootUrl() + largest.getHref()) .replace("%%%PROJECT_NAME%%%", pwaConfiguration.getAppName()); }
private BufferedImage drawIconImage(BufferedImage baseImage, int bgColor, PwaIcon icon) { BufferedImage bimage = new BufferedImage(icon.getWidth(), icon.getHeight(), BufferedImage.TYPE_INT_ARGB); graphics.clearRect(0, 0, icon.getWidth(), icon.getHeight()); / (float) icon.getWidth() > (float) baseImage.getHeight() / (float) icon.getHeight() ? (float) baseImage.getWidth() / (float) icon.getWidth() : (float) baseImage.getHeight() / (float) icon.getHeight(); baseImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH), (icon.getWidth() - newWidth) / 2, (icon.getHeight() - newHeight) / 2, null); graphics.dispose();