DisplayCompat
public final class DisplayCompat
A class for retrieving accurate display modes for a display.
On many Android TV devices, Display.Mode may not report the accurate width and height because these devices do not have powerful enough graphics pipelines to run framework code at the same resolutions supported by their video pipelines. For these devices, there is no way for an app to determine, for example, whether or not the current display mode is 4k, or that the display supports switching to other 4k modes. This class offers a workaround for this problem.
Summary
Nested types |
|---|
public final class DisplayCompat.ModeCompatCompat class which provides access to the underlying display mode, if there is one, and a more reliable display mode size. |
Public methods |
|
|---|---|
static @NonNull DisplayCompat.ModeCompat |
Gets the current display mode of the given display, where the size can be relied on to determine support for 4k on Android TV devices. |
static @Nullable RoundedCornerCompat |
getRoundedCorner(@NonNull Display display, int position)Returns the |
static @NonNull DisplayCompat.ModeCompat[] |
getSupportedModes(@NonNull Context context, @NonNull Display display)Gets the supported modes of the given display where any mode with the same size as the current mode can be relied on to determine support for 4k on Android TV devices. |
Public methods
getMode
public static @NonNull DisplayCompat.ModeCompat getMode(@NonNull Context context, @NonNull Display display)
Gets the current display mode of the given display, where the size can be relied on to determine support for 4k on Android TV devices.
getRoundedCorner
public static @Nullable RoundedCornerCompat getRoundedCorner(@NonNull Display display, int position)
Returns the RoundedCornerCompat of the given position if there is one.
| Parameters | |
|---|---|
@NonNull Display display |
the given display. |
int position |
the position of the rounded corner on the display. |
| Returns | |
|---|---|
@Nullable RoundedCornerCompat |
the rounded corner of the given position. Returns |
getSupportedModes
public static @NonNull DisplayCompat.ModeCompat[] getSupportedModes(@NonNull Context context, @NonNull Display display)
Gets the supported modes of the given display where any mode with the same size as the current mode can be relied on to determine support for 4k on Android TV devices.