public class ViewUtils
extends java.lang.Object
Constructor and Description |
---|
ViewUtils() |
Modifier and Type | Method and Description |
---|---|
static double |
convertDpToPixels(android.content.Context context,
double valueInDp) |
static int |
getMaxSafeBottomInset(WindowInsetsCompat windowInsets) |
static int |
getMaxSafeLeftInset(WindowInsetsCompat windowInsets) |
static int |
getMaxSafeRightInset(WindowInsetsCompat windowInsets) |
static int |
getMaxSafeTopInset(WindowInsetsCompat windowInsets) |
static boolean |
isCurrentOrientationValid(int currentScreenOrientation,
Orientation preferredOrientation) |
static boolean |
isDeviceInNightMode(android.content.Context context)
Checks if the device is in night mode.
|
static boolean |
isDeviceNotInTouchMode(android.view.View view)
Detects if this device is currently in touch mode given a
View . |
static boolean |
isRunningOnTablet(android.app.Activity activity) |
static void |
removeViewFromParent(android.view.View view) |
static void |
setActivityRequestedOrientation(android.app.Activity activity,
int requestedOrientation)
Safely calls
Activity.setRequestedOrientation(int) |
static void |
setFocusableInTouchModeAndRequestFocus(android.view.View view) |
static void |
setHeightOnViewLayoutParams(android.view.View view,
int height) |
public static void removeViewFromParent(android.view.View view)
public static void setFocusableInTouchModeAndRequestFocus(android.view.View view)
public static double convertDpToPixels(android.content.Context context, double valueInDp)
public static boolean isRunningOnTablet(android.app.Activity activity)
public static void setActivityRequestedOrientation(android.app.Activity activity, int requestedOrientation)
Activity.setRequestedOrientation(int)
public static void setHeightOnViewLayoutParams(android.view.View view, int height)
public static boolean isDeviceInNightMode(android.content.Context context)
public static boolean isCurrentOrientationValid(int currentScreenOrientation, Orientation preferredOrientation)
Configuration.ORIENTATION_LANDSCAPE
)
matches the preferred orientation (e.g. Orientation.LANDSCAPE
.public static int getMaxSafeLeftInset(WindowInsetsCompat windowInsets)
public static int getMaxSafeRightInset(WindowInsetsCompat windowInsets)
public static int getMaxSafeTopInset(WindowInsetsCompat windowInsets)
public static int getMaxSafeBottomInset(WindowInsetsCompat windowInsets)
public static boolean isDeviceNotInTouchMode(android.view.View view)
View
.