Google is committed to advancing racial equity for Black communities. See how.

ModeCompat

class ModeCompat
kotlin.Any
   ↳ androidx.core.view.DisplayCompat.ModeCompat

Compat class which provides an additional isNative() field. This field indicates whether a mode is native, which is important when searching for the highest possible native resolution of a display.

Summary

Public methods
Int

Returns the physical height of the given display when configured in this mode

Int

Returns the physical width of the given display when configured in this mode

Boolean

This field indicates whether a mode is native, which is important when searching for the highest possible native resolution of a display.

Mode?

Function to get the wrapped object

Public methods

getPhysicalHeight

fun getPhysicalHeight(): Int

Returns the physical height of the given display when configured in this mode

Return
Int the physical screen height in pixels

getPhysicalWidth

fun getPhysicalWidth(): Int

Returns the physical width of the given display when configured in this mode

Return
Int the physical screen width in pixels

isNative

fun isNative(): Boolean

This field indicates whether a mode is native, which is important when searching for the highest possible native resolution of a display.

Return
Boolean true if this is a native mode of the wrapped display

toMode

@RequiresApi(23) @Nullable fun toMode(): Mode?

Function to get the wrapped object

Return
Mode? the wrapped Display.Mode object or null if there was no matching mode for the native resolution.