Class IconCache


  • public class IconCache
    extends Object
    Icon Cache of icon bitmaps
    Since:
    3.2.0
    • Field Detail

      • DEFAULT_CACHE_SIZE

        public static final int DEFAULT_CACHE_SIZE
        Default max number of icon bitmaps to retain in cache
        See Also:
        Constant Field Values
    • Constructor Detail

      • IconCache

        public IconCache()
        Constructor, created with cache size of DEFAULT_CACHE_SIZE
      • IconCache

        public IconCache​(int size)
        Constructor
        Parameters:
        size - max icon bitmaps to retain in the cache
    • Method Detail

      • get

        public Bitmap get​(IconRow iconRow)
        Get the cached bitmap for the icon row or null if not cached
        Parameters:
        iconRow - icon row
        Returns:
        icon bitmap or null
      • get

        public Bitmap get​(long iconRowId)
        Get the cached bitmap for the icon row id or null if not cached
        Parameters:
        iconRowId - icon row id
        Returns:
        icon bitmap or null
      • put

        public Bitmap put​(IconRow iconRow,
                          Bitmap bitmap)
        Cache the icon bitmap for the icon row
        Parameters:
        iconRow - icon row
        bitmap - icon bitmap
        Returns:
        previous cached icon bitmap or null
      • put

        public Bitmap put​(long iconRowId,
                          Bitmap bitmap)
        Cache the icon bitmap for the icon row id
        Parameters:
        iconRowId - icon row id
        bitmap - icon bitmap
        Returns:
        previous cached icon bitmap or null
      • remove

        public Bitmap remove​(IconRow iconRow)
        Remove the cached bitmap for the icon row
        Parameters:
        iconRow - icon row
        Returns:
        removed icon bitmap or null
      • remove

        public Bitmap remove​(long iconRowId)
        Remove the cached bitmap for the icon row id
        Parameters:
        iconRowId - icon row id
        Returns:
        removed icon bitmap or null
      • clear

        public void clear()
        Clear the cache
      • resize

        public void resize​(int maxSize)
        Resize the cache
        Parameters:
        maxSize - max size
      • createIcon

        public Bitmap createIcon​(IconRow icon)
        Create or retrieve from cache an icon bitmap for the icon row
        Parameters:
        icon - icon row
        Returns:
        icon bitmap
      • createIcon

        public Bitmap createIcon​(IconRow icon,
                                 float density)
        Create or retrieve from cache an icon bitmap for the icon row
        Parameters:
        icon - icon row
        density - display density: DisplayMetrics.density
        Returns:
        icon bitmap
      • createIconNoCache

        public static Bitmap createIconNoCache​(IconRow icon)
        Create an icon bitmap for the icon row without caching
        Parameters:
        icon - icon row
        Returns:
        icon bitmap
      • createIconNoCache

        public static Bitmap createIconNoCache​(IconRow icon,
                                               float density)
        Create an icon bitmap for the icon row without caching
        Parameters:
        icon - icon row
        density - display density: DisplayMetrics.density
        Returns:
        icon bitmap
      • createIcon

        public static Bitmap createIcon​(IconRow icon,
                                        IconCache iconCache)
        Create or retrieve from cache an icon bitmap for the icon row
        Parameters:
        icon - icon row
        iconCache - icon cache
        Returns:
        icon bitmap
      • createIcon

        public static Bitmap createIcon​(IconRow icon,
                                        float density,
                                        IconCache iconCache)
        Create or retrieve from cache an icon bitmap for the icon row
        Parameters:
        icon - icon row
        density - display density: DisplayMetrics.density
        iconCache - icon cache
        Returns:
        icon bitmap