android.support.v4.hardware.display.DisplayManagerCompat Java Examples

The following examples show how to use android.support.v4.hardware.display.DisplayManagerCompat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CameraView.java    From camerakit-android with MIT License 5 votes vote down vote up
@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    if (!isInEditMode()) {
        mDisplayOrientationDetector.enable(
                ViewCompat.isAttachedToWindow(this)
                        ? DisplayManagerCompat.getInstance(getContext().getApplicationContext())
                        .getDisplay(Display.DEFAULT_DISPLAY)
                        : null
        );
    }
}
 
Example #2
Source File: ViewCompat2.java    From MediaPickerInstagram with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the logical display to which the view's window has been attached.
 *
 * @param view The view.
 * @return The logical display, or null if the view is not currently attached to a window.
 */
public static Display getDisplay(@NonNull View view) {
    if (Build.VERSION.SDK_INT >= 17) {
        return view.getDisplay();
    }
    return ViewCompat.isAttachedToWindow(view) ?
            DisplayManagerCompat.getInstance(view.getContext())
                    .getDisplay(Display.DEFAULT_DISPLAY) : null;
}
 
Example #3
Source File: MediaRouter.java    From cwac-mediarouter with Apache License 2.0 5 votes vote down vote up
GlobalMediaRouter(Context applicationContext) {
    mApplicationContext = applicationContext;
    mDisplayManager = DisplayManagerCompat.getInstance(applicationContext);
    mLowRam = ActivityManagerCompat.isLowRamDevice(
            (ActivityManager)applicationContext.getSystemService(
                    Context.ACTIVITY_SERVICE));

    // Add the system media route provider for interoperating with
    // the framework media router.  This one is special and receives
    // synchronization messages from the media router.
    mSystemProvider = SystemMediaRouteProvider.obtain(applicationContext, this);
    addProvider(mSystemProvider);
}