Device

Class of snx.android · Device.java

public final class Device

The device the app runs on: one display, the window's, and the configuration that follows from it. The runtime sets its size and density (snx.android.width, snx.android.height in pixels, snx.android.dpi); without them a phone-shaped window.

Methods

public static synchronized void set(int width, int height, int dpi, boolean night) source

The display's size in pixels and its density: the metrics and the configuration again.

public static void resize(int width, int height) source

The window's new size: the display's. The resources take the new metrics and configuration at once, and the application and the activities get the configuration change on the main thread (snx.android.app.Activities).

public static void rotate(int requested) source

The display turned for an activity's requested orientation (ActivityInfo.SCREEN_ORIENTATION_*), as Android's window manager turns it for the top activity: a landscape one on a display that is taller than wide, or a portrait one on a display that is wider than tall, swaps the display's width and height. The window follows (snx.android.ui.Window.rotate). The other orientations (unspecified, sensor, user, behind, locked) keep it.

public static synchronized DisplayMetrics metrics() source

A copy of the display's metrics.

public static synchronized Configuration configuration() source

A copy of the device's configuration.


Made from ScarletNX's Sail at 166ad3910f80. The framework is ScarletNX's (GPL-3.0-or-later); the parts that follow the Android Open Source Project's sources (Apache-2.0) say so in their files.