Class MemorySizeCalculator.Builder

  • Enclosing class:
    MemorySizeCalculator

    public static final class MemorySizeCalculator.Builder
    extends java.lang.Object
    Constructs an MemorySizeCalculator with reasonable defaults that can be optionally overridden.
    • Constructor Detail

      • Builder

        public Builder​(android.content.Context context)
    • Method Detail

      • setMemoryCacheScreens

        public MemorySizeCalculator.Builder setMemoryCacheScreens​(float memoryCacheScreens)
        Sets the number of device screens worth of pixels the MemoryCache should be able to hold and returns this Builder.
      • setBitmapPoolScreens

        public MemorySizeCalculator.Builder setBitmapPoolScreens​(float bitmapPoolScreens)
        Sets the number of device screens worth of pixels the BitmapPool should be able to hold and returns this Builder.
      • setMaxSizeMultiplier

        public MemorySizeCalculator.Builder setMaxSizeMultiplier​(float maxSizeMultiplier)
        Sets the maximum percentage of the device's memory class for standard devices that can be taken up by Glide's MemoryCache and BitmapPool put together, and returns this builder.
      • setLowMemoryMaxSizeMultiplier

        public MemorySizeCalculator.Builder setLowMemoryMaxSizeMultiplier​(float lowMemoryMaxSizeMultiplier)
        Sets the maximum percentage of the device's memory class for low ram devices that can be taken up by Glide's MemoryCache and BitmapPool put together, and returns this builder.
        See Also:
        ActivityManager.isLowRamDevice()
      • setArrayPoolSize

        public MemorySizeCalculator.Builder setArrayPoolSize​(int arrayPoolSizeBytes)
        Sets the size in bytes of the ArrayPool to use to store temporary arrays while decoding data and returns this builder.

        This number will be halved on low memory devices that return true from ActivityManager.isLowRamDevice().