Example usage for android.view Display getName

List of usage examples for android.view Display getName

Introduction

In this page you can find the example usage for android.view Display getName.

Prototype

public String getName() 

Source Link

Document

Gets the name of the display.

Usage

From source file:org.acra.collector.DisplayManagerCollector.java

@NonNull
private static String collectName(@NonNull Display display) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return display.getDisplayId() + ".name=" + display.getName() + '\n';
    }//w w  w  .j  a va  2 s .c  o m
    return "";
}

From source file:me.wimanacra.collector.DisplayManagerCollector.java

private static void collectName(@NonNull Display display, JSONObject container) throws JSONException {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        container.put("name", display.getName());
    }/*from   www.  j  a v a  2s  . c  om*/
}

From source file:org.chromium.ChromeSystemDisplay.java

private JSONObject getDisplayInfo(final Display display) throws JSONException {
    JSONObject displayInfo = new JSONObject();

    displayInfo.put("id", Integer.toString(display.getDisplayId()));
    try {// ww  w  .j  a v  a  2 s  .  co m
        displayInfo.put("name", display.getName());
    } catch (NoSuchMethodError e) {
        displayInfo.put("name", "Default");
    }
    displayInfo.put("isPrimary", display.getDisplayId() == android.view.Display.DEFAULT_DISPLAY);
    displayInfo.put("dpiX", getDpiX(display));
    displayInfo.put("dpiY", getDpiY(display));
    displayInfo.put("rotation", getRotation(display));
    displayInfo.put("bounds", getBounds(display));
    displayInfo.put("overscan", getOverscan());
    displayInfo.put("workArea", getWorkArea(display));
    // mirroringSourceId, isInternal and isEnabled cannot be retrieved at this moment.

    return displayInfo;
}

From source file:org.xwalk.runtime.extension.api.device_capabilities.DeviceCapabilitiesDisplay.java

public JSONObject convertDisplayToJSON(Display disp) {
    DisplayMetrics displayMetrics = new DisplayMetrics();
    disp.getRealMetrics(displayMetrics);

    Point realSize = new Point();
    disp.getRealSize(realSize);/*from   w  w  w .  j a v  a2  s  .c  o m*/

    Point availSize = new Point();
    disp.getSize(availSize);

    JSONObject out = new JSONObject();
    try {
        out.put("id", disp.getDisplayId());
        out.put("name", disp.getName());
        out.put("isPrimary", disp.getDisplayId() == disp.DEFAULT_DISPLAY);
        out.put("isInternal", disp.getDisplayId() == disp.DEFAULT_DISPLAY);
        out.put("dpiX", (int) displayMetrics.xdpi);
        out.put("dpiY", (int) displayMetrics.ydpi);
        out.put("width", realSize.x);
        out.put("height", realSize.y);
        out.put("availWidth", availSize.x);
        out.put("availHeight", availSize.y);
    } catch (JSONException e) {
        return mDeviceCapabilities.setErrorMessage(e.toString());
    }
    return out;
}