Package icyllis.modernui.util

# Class DisplayMetrics

java.lang.Object
icyllis.modernui.util.DisplayMetrics

public class DisplayMetrics extends Object
A structure describing general information about a display, such as its size, density, and font scaling.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `float`
  `density`
  The logical density of the display.
  This is a scaling factor for the Density Independent Pixel unit, where one DIP is one pixel on an approximately 72 dpi screen, providing the baseline of the system's display.
  `static final int`
  `DENSITY_108`
  Intermediate density for screens that sit between `DENSITY_MEDIUM` (96dpi) and `DENSITY_HIGH` (144dpi).
  `static final int`
  `DENSITY_120`
  Intermediate density for screens that sit between `DENSITY_MEDIUM` (96dpi) and `DENSITY_HIGH` (144dpi).
  `static final int`
  `DENSITY_132`
  Intermediate density for screens that sit between `DENSITY_MEDIUM` (96dpi) and `DENSITY_HIGH` (144dpi).
  `static final int`
  `DENSITY_156`
  Intermediate density for screens that sit between `DENSITY_HIGH` (144dpi) and `DENSITY_XHIGH` (192dpi).
  `static final int`
  `DENSITY_168`
  Intermediate density for screens that sit between `DENSITY_HIGH` (144dpi) and `DENSITY_XHIGH` (192dpi).
  `static final int`
  `DENSITY_180`
  Intermediate density for screens that sit between `DENSITY_HIGH` (144dpi) and `DENSITY_XHIGH` (192dpi).
  `static final int`
  `DENSITY_204`
  Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi).
  `static final int`
  `DENSITY_216`
  Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi).
  `static final int`
  `DENSITY_228`
  Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi).
  `static final int`
  `DENSITY_240`
  Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi).
  `static final int`
  `DENSITY_252`
  Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi).
  `static final int`
  `DENSITY_264`
  Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi).
  `static final int`
  `DENSITY_276`
  Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi).
  `static final int`
  `DENSITY_84`
  Intermediate density for screens that sit between `DENSITY_LOW` (72dpi) and `DENSITY_MEDIUM` (96dpi).
  `static final int`
  `DENSITY_DEFAULT`
  The reference density used throughout the system.
  `static final float`
  `DENSITY_DEFAULT_SCALE`
  Scaling factor to convert a density in DPI units to the density scale.
  `static final int`
  `DENSITY_HIGH`
  Standard quantized DPI for high-density screens.
  `static final int`
  `DENSITY_LOW`
  Standard quantized DPI for low-density screens.
  `static final int`
  `DENSITY_MEDIUM`
  Standard quantized DPI for medium-density screens.
  `static final int`
  `DENSITY_XHIGH`
  Standard quantized DPI for extra-high-density screens.
  `static final int`
  `DENSITY_XXHIGH`
  Standard quantized DPI for extra-extra-high-density screens.
  `int`
  `densityDpi`
  The screen density expressed as dots-per-inch.
  May be either `DENSITY_LOW`, `DENSITY_MEDIUM`, or `DENSITY_HIGH`.
  `int`
  `heightPixels`
  The absolute height of the available display size in pixels.
  `float`
  `scaledDensity`
  A scaling factor for fonts displayed on the display.
  This is the same as `density`, except that it may be adjusted in smaller increments at runtime based on a user preference for the font size.
  `int`
  `widthPixels`
  The absolute width of the available display size in pixels.
  `float`
  `xdpi`
  The exact physical pixels per inch of the screen in the X dimension.
  `float`
  `ydpi`
  The exact physical pixels per inch of the screen in the Y dimension.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DisplayMetrics()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(DisplayMetrics other)`
  Returns true if these display metrics equal the other display metrics.
  `boolean`
  `equals(Object o)`
  `boolean`
  `equalsPhysical(DisplayMetrics other)`
  Returns true if the physical aspects of the two display metrics are equal.
  `int`
  `hashCode()`
  `void`
  `setTo(DisplayMetrics o)`
  `void`
  `setToDefaults()`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### DENSITY_LOW

    public static final int DENSITY_LOW
    Standard quantized DPI for low-density screens.
    See Also:
      - Constant Field Values

  - ### DENSITY_84

    public static final int DENSITY_84
    Intermediate density for screens that sit between `DENSITY_LOW` (72dpi) and `DENSITY_MEDIUM` (96dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_MEDIUM` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_MEDIUM

    public static final int DENSITY_MEDIUM
    Standard quantized DPI for medium-density screens.
    See Also:
      - Constant Field Values

  - ### DENSITY_108

    public static final int DENSITY_108
    Intermediate density for screens that sit between `DENSITY_MEDIUM` (96dpi) and `DENSITY_HIGH` (144dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_HIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_120

    public static final int DENSITY_120
    Intermediate density for screens that sit between `DENSITY_MEDIUM` (96dpi) and `DENSITY_HIGH` (144dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_HIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_132

    public static final int DENSITY_132
    Intermediate density for screens that sit between `DENSITY_MEDIUM` (96dpi) and `DENSITY_HIGH` (144dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_HIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_HIGH

    public static final int DENSITY_HIGH
    Standard quantized DPI for high-density screens.
    See Also:
      - Constant Field Values

  - ### DENSITY_156

    public static final int DENSITY_156
    Intermediate density for screens that sit between `DENSITY_HIGH` (144dpi) and `DENSITY_XHIGH` (192dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_168

    public static final int DENSITY_168
    Intermediate density for screens that sit between `DENSITY_HIGH` (144dpi) and `DENSITY_XHIGH` (192dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_180

    public static final int DENSITY_180
    Intermediate density for screens that sit between `DENSITY_HIGH` (144dpi) and `DENSITY_XHIGH` (192dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_XHIGH

    public static final int DENSITY_XHIGH
    Standard quantized DPI for extra-high-density screens.
    See Also:
      - Constant Field Values

  - ### DENSITY_204

    public static final int DENSITY_204
    Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XXHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_216

    public static final int DENSITY_216
    Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XXHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_228

    public static final int DENSITY_228
    Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XXHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_240

    public static final int DENSITY_240
    Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XXHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_252

    public static final int DENSITY_252
    Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XXHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_264

    public static final int DENSITY_264
    Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XXHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_276

    public static final int DENSITY_276
    Intermediate density for screens that sit somewhere between `DENSITY_XHIGH` (192 dpi) and `DENSITY_XXHIGH` (288 dpi). This is not a density that applications should target, instead relying on the system to scale their `DENSITY_XXHIGH` assets for them.
    See Also:
      - Constant Field Values

  - ### DENSITY_XXHIGH

    public static final int DENSITY_XXHIGH
    Standard quantized DPI for extra-extra-high-density screens.
    See Also:
      - Constant Field Values

  - ### DENSITY_DEFAULT

    public static final int DENSITY_DEFAULT
    The reference density used throughout the system.
    See Also:
      - Constant Field Values

  - ### DENSITY_DEFAULT_SCALE

    public static final float DENSITY_DEFAULT_SCALE
    Scaling factor to convert a density in DPI units to the density scale.
    See Also:
      - Constant Field Values

  - ### widthPixels

    public int widthPixels
    The absolute width of the available display size in pixels.

  - ### heightPixels

    public int heightPixels
    The absolute height of the available display size in pixels.

  - ### density

    public float density
    The logical density of the display.
    This is a scaling factor for the Density Independent Pixel unit, where one DIP is one pixel on an approximately 72 dpi screen, providing the baseline of the system's display. Thus on a 72 dpi screen this density value will be 1; on a 96 dpi screen it would be 1.33; etc.

    This value does not exactly follow the real screen size (as given by `xdpi` and `ydpi`), but rather is used to scale the size of the overall UI in steps based on gross changes in the display dpi.

    See Also:
      - `DENSITY_DEFAULT`

  - ### densityDpi

    public int densityDpi
    The screen density expressed as dots-per-inch.
    May be either `DENSITY_LOW`, `DENSITY_MEDIUM`, or `DENSITY_HIGH`.

  - ### scaledDensity

    public float scaledDensity
    A scaling factor for fonts displayed on the display.
    This is the same as `density`, except that it may be adjusted in smaller increments at runtime based on a user preference for the font size.

  - ### xdpi

    public float xdpi
    The exact physical pixels per inch of the screen in the X dimension.

  - ### ydpi

    public float ydpi
    The exact physical pixels per inch of the screen in the Y dimension.

- ## Constructor Details

  - ### DisplayMetrics

    public DisplayMetrics()

- ## Method Details

  - ### setTo

    public void setTo(DisplayMetrics o)

  - ### setToDefaults

    public void setToDefaults()

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### equals

    public boolean equals(DisplayMetrics other)
    Returns true if these display metrics equal the other display metrics.
    Parameters:
      `other` - The display metrics with which to compare.
    Returns:
      True if the display metrics are equal.

  - ### equalsPhysical

    public boolean equalsPhysical(DisplayMetrics other)
    Returns true if the physical aspects of the two display metrics are equal. This ignores the scaled density, which is a logical attribute based on the current desired font size.
    Parameters:
      `other` - The display metrics with which to compare.
    Returns:
      True if the display metrics are equal.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`