Class PWAScreenshots

java.lang.Object
com.iizix.pwa.PWAScreenshots

public final class PWAScreenshots extends Object
The screenshots of an installable application (CC-PUSH-PWA-PAGES Set I, ruling PM-2): the PNG and JPEG files the designer put into the PWA folder's screenshots/ directory (PWAIcons.FOLDER_SCREENSHOTS), listed in the manifest's screenshots member with their sizes read from the files and their form_factor from their shape - narrow when taller than wide (a phone), wide otherwise (a desktop) - and served by the application directory as /app/<appID>/screenshots/<name>. Optional, never captured automatically: an application without the directory has no screenshots member.

Pure: bytes in, a list out, in the order of the file names.

Author:
Christopher Mindus
  • Field Details

    • SERVED_PREFIX

      public static final String SERVED_PREFIX
      The prefix of a screenshot's served name under the application directory: "screenshots/".
      See Also:
    • NARROW

      public static final String NARROW
      The form factor of a screenshot taller than wide.
      See Also:
    • WIDE

      public static final String WIDE
      The form factor of a screenshot at least as wide as tall.
      See Also:
  • Method Details

    • list

      public static List<PWAScreenshots.Shot> list(String appID, Map<String,byte[]> assets)
      Lists the screenshots among a module's asset files: every .png, .jpg or .jpeg directly under PWAIcons.FOLDER_SCREENSHOTS, by name. A file that is not an image that can be read is left out with one WARNING naming it.
      Parameters:
      appID - The application ID, for the log.
      assets - The asset files by path relative to the assets directory with '/' separators, or null.
      Returns:
      The screenshots in the order of their names, unmodifiable; empty for none.
    • mediaType

      public static String mediaType(String path)
      Gets the media type of a screenshot file by its extension.
      Parameters:
      path - The path or name.
      Returns:
      image/png, image/jpeg, or null for another extension.