Search in sources :

Example 71 with Display

use of android.view.Display in project android_frameworks_base by AOSPA.

the class VirtualDisplayTest method testPrivateVirtualDisplay.

/**
     * Ensures that an application can create a private virtual display and show
     * its own windows on it.
     */
public void testPrivateVirtualDisplay() throws Exception {
    VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, 0);
    assertNotNull("virtual display must not be null", virtualDisplay);
    Display display = virtualDisplay.getDisplay();
    try {
        assertDisplayRegistered(display, Display.FLAG_PRIVATE);
        // Show a private presentation on the display.
        assertDisplayCanShowPresentation("private presentation window", display, BLUEISH, WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION, 0);
    } finally {
        virtualDisplay.release();
    }
    assertDisplayUnregistered(display);
}
Also used : VirtualDisplay(android.hardware.display.VirtualDisplay) Display(android.view.Display) VirtualDisplay(android.hardware.display.VirtualDisplay)

Example 72 with Display

use of android.view.Display in project android_frameworks_base by AOSPA.

the class VirtualDisplayTest method testSecurePublicPresentationVirtualDisplay.

/**
     * Ensures that an application can create a secure public virtual display and show
     * its own windows on it.  This test requires the CAPTURE_SECURE_VIDEO_OUTPUT permission.
     *
     * Because this test does not have an activity token, we use the TOAST window
     * type to create the window.  Another choice might be SYSTEM_ALERT_WINDOW but
     * that requires a permission.
     */
public void testSecurePublicPresentationVirtualDisplay() throws Exception {
    VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION);
    assertNotNull("virtual display must not be null", virtualDisplay);
    Display display = virtualDisplay.getDisplay();
    try {
        assertDisplayRegistered(display, Display.FLAG_PRESENTATION | Display.FLAG_SECURE);
        // Mirroring case with secure window (and display is secure).
        // Show a window on the default display.  It should be mirrored to the
        // virtual display automatically.
        Display defaultDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY);
        assertDisplayCanShowPresentation("mirrored secure window on secure display", defaultDisplay, GREENISH, WindowManager.LayoutParams.TYPE_TOAST, WindowManager.LayoutParams.FLAG_SECURE);
        // Presentation case with secure window (and display is secure).
        // Show a normal presentation on the display.
        assertDisplayCanShowPresentation("secure presentation window on secure display", display, BLUEISH, WindowManager.LayoutParams.TYPE_TOAST, WindowManager.LayoutParams.FLAG_SECURE);
    } finally {
        virtualDisplay.release();
    }
    assertDisplayUnregistered(display);
}
Also used : VirtualDisplay(android.hardware.display.VirtualDisplay) Display(android.view.Display) VirtualDisplay(android.hardware.display.VirtualDisplay)

Example 73 with Display

use of android.view.Display in project generic-oauth2-login-for-android by wareninja.

the class FacebookOAuthDialog method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");
    mContent = new LinearLayout(getContext());
    mContent.setOrientation(LinearLayout.VERTICAL);
    setUpTitle();
    setUpWebView();
    Display display = getWindow().getWindowManager().getDefaultDisplay();
    final float scale = getContext().getResources().getDisplayMetrics().density;
    float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
    addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f)));
}
Also used : FrameLayout(android.widget.FrameLayout) ProgressDialog(android.app.ProgressDialog) LinearLayout(android.widget.LinearLayout) Display(android.view.Display)

Example 74 with Display

use of android.view.Display in project generic-oauth2-login-for-android by wareninja.

the class FsqOAuthDialog method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");
    mContent = new LinearLayout(getContext());
    mContent.setOrientation(LinearLayout.VERTICAL);
    setUpTitle();
    setUpWebView();
    Display display = getWindow().getWindowManager().getDefaultDisplay();
    final float scale = getContext().getResources().getDisplayMetrics().density;
    float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
    addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f)));
}
Also used : FrameLayout(android.widget.FrameLayout) ProgressDialog(android.app.ProgressDialog) LinearLayout(android.widget.LinearLayout) Display(android.view.Display)

Example 75 with Display

use of android.view.Display in project generic-oauth2-login-for-android by wareninja.

the class GowallaOAuthDialog method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");
    mContent = new LinearLayout(getContext());
    mContent.setOrientation(LinearLayout.VERTICAL);
    setUpTitle();
    setUpWebView();
    Display display = getWindow().getWindowManager().getDefaultDisplay();
    final float scale = getContext().getResources().getDisplayMetrics().density;
    float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
    addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f)));
}
Also used : FrameLayout(android.widget.FrameLayout) ProgressDialog(android.app.ProgressDialog) LinearLayout(android.widget.LinearLayout) Display(android.view.Display)

Aggregations

Display (android.view.Display)697 Point (android.graphics.Point)356 WindowManager (android.view.WindowManager)349 DisplayMetrics (android.util.DisplayMetrics)126 View (android.view.View)57 TextView (android.widget.TextView)54 LinearLayout (android.widget.LinearLayout)45 SuppressLint (android.annotation.SuppressLint)43 Method (java.lang.reflect.Method)41 ImageView (android.widget.ImageView)39 Bitmap (android.graphics.Bitmap)38 Resources (android.content.res.Resources)36 Intent (android.content.Intent)34 Camera (android.hardware.Camera)31 Context (android.content.Context)26 Rect (android.graphics.Rect)25 IOException (java.io.IOException)24 ViewGroup (android.view.ViewGroup)23 Canvas (android.graphics.Canvas)22 RemoteException (android.os.RemoteException)22