Example usage for android.util DisplayMetrics DENSITY_DEVICE_STABLE

List of usage examples for android.util DisplayMetrics DENSITY_DEVICE_STABLE

Introduction

In this page you can find the example usage for android.util DisplayMetrics DENSITY_DEVICE_STABLE.

Prototype

int DENSITY_DEVICE_STABLE

To view the source code for android.util DisplayMetrics DENSITY_DEVICE_STABLE.

Click Source Link

Document

The device's stable density.

Usage

From source file:com.android.launcher3.Utilities.java

public static boolean getAllowRotationDefaultValue(Context context) {
    if (isNycOrAbove()) {
        // If the device was scaled, used the original dimensions to determine if rotation
        // is allowed of not.
        Resources res = context.getResources();
        int originalSmallestWidth = res.getConfiguration().smallestScreenWidthDp
                * res.getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEVICE_STABLE;
        return originalSmallestWidth >= 600;
    }//  w ww. j a va 2  s  .  c o  m
    return false;
}