Search in sources :

Example 6 with WindowManagerImpl

use of android.view.WindowManagerImpl in project android_frameworks_base by crdroidandroid.

the class Presentation method createPresentationContext.

private static Context createPresentationContext(Context outerContext, Display display, int theme) {
    if (outerContext == null) {
        throw new IllegalArgumentException("outerContext must not be null");
    }
    if (display == null) {
        throw new IllegalArgumentException("display must not be null");
    }
    Context displayContext = outerContext.createDisplayContext(display);
    if (theme == 0) {
        TypedValue outValue = new TypedValue();
        displayContext.getTheme().resolveAttribute(com.android.internal.R.attr.presentationTheme, outValue, true);
        theme = outValue.resourceId;
    }
    // Derive the display's window manager from the outer window manager.
    // We do this because the outer window manager have some extra information
    // such as the parent window, which is important if the presentation uses
    // an application window type.
    final WindowManagerImpl outerWindowManager = (WindowManagerImpl) outerContext.getSystemService(Context.WINDOW_SERVICE);
    final WindowManagerImpl displayWindowManager = outerWindowManager.createPresentationWindowManager(displayContext);
    return new ContextThemeWrapper(displayContext, theme) {

        @Override
        public Object getSystemService(String name) {
            if (Context.WINDOW_SERVICE.equals(name)) {
                return displayWindowManager;
            }
            return super.getSystemService(name);
        }
    };
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) WindowManagerImpl(android.view.WindowManagerImpl) TypedValue(android.util.TypedValue)

Example 7 with WindowManagerImpl

use of android.view.WindowManagerImpl in project android_frameworks_base by crdroidandroid.

the class DecorContext method getSystemService.

@Override
public Object getSystemService(String name) {
    if (Context.WINDOW_SERVICE.equals(name)) {
        if (mWindowManager == null) {
            WindowManagerImpl wm = (WindowManagerImpl) super.getSystemService(Context.WINDOW_SERVICE);
            mWindowManager = wm.createLocalWindowManager(mPhoneWindow);
        }
        return mWindowManager;
    }
    return super.getSystemService(name);
}
Also used : WindowManagerImpl(android.view.WindowManagerImpl)

Example 8 with WindowManagerImpl

use of android.view.WindowManagerImpl in project android_frameworks_base by ParanoidAndroid.

the class Presentation method createPresentationContext.

private static Context createPresentationContext(Context outerContext, Display display, int theme) {
    if (outerContext == null) {
        throw new IllegalArgumentException("outerContext must not be null");
    }
    if (display == null) {
        throw new IllegalArgumentException("display must not be null");
    }
    Context displayContext = outerContext.createDisplayContext(display);
    if (theme == 0) {
        TypedValue outValue = new TypedValue();
        displayContext.getTheme().resolveAttribute(com.android.internal.R.attr.presentationTheme, outValue, true);
        theme = outValue.resourceId;
    }
    // Derive the display's window manager from the outer window manager.
    // We do this because the outer window manager have some extra information
    // such as the parent window, which is important if the presentation uses
    // an application window type.
    final WindowManagerImpl outerWindowManager = (WindowManagerImpl) outerContext.getSystemService(Context.WINDOW_SERVICE);
    final WindowManagerImpl displayWindowManager = outerWindowManager.createPresentationWindowManager(display);
    return new ContextThemeWrapper(displayContext, theme) {

        @Override
        public Object getSystemService(String name) {
            if (Context.WINDOW_SERVICE.equals(name)) {
                return displayWindowManager;
            }
            return super.getSystemService(name);
        }
    };
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) WindowManagerImpl(android.view.WindowManagerImpl) TypedValue(android.util.TypedValue)

Example 9 with WindowManagerImpl

use of android.view.WindowManagerImpl in project android_frameworks_base by DirtyUnicorns.

the class Presentation method createPresentationContext.

private static Context createPresentationContext(Context outerContext, Display display, int theme) {
    if (outerContext == null) {
        throw new IllegalArgumentException("outerContext must not be null");
    }
    if (display == null) {
        throw new IllegalArgumentException("display must not be null");
    }
    Context displayContext = outerContext.createDisplayContext(display);
    if (theme == 0) {
        TypedValue outValue = new TypedValue();
        displayContext.getTheme().resolveAttribute(com.android.internal.R.attr.presentationTheme, outValue, true);
        theme = outValue.resourceId;
    }
    // Derive the display's window manager from the outer window manager.
    // We do this because the outer window manager have some extra information
    // such as the parent window, which is important if the presentation uses
    // an application window type.
    final WindowManagerImpl outerWindowManager = (WindowManagerImpl) outerContext.getSystemService(Context.WINDOW_SERVICE);
    final WindowManagerImpl displayWindowManager = outerWindowManager.createPresentationWindowManager(displayContext);
    return new ContextThemeWrapper(displayContext, theme) {

        @Override
        public Object getSystemService(String name) {
            if (Context.WINDOW_SERVICE.equals(name)) {
                return displayWindowManager;
            }
            return super.getSystemService(name);
        }
    };
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) WindowManagerImpl(android.view.WindowManagerImpl) TypedValue(android.util.TypedValue)

Example 10 with WindowManagerImpl

use of android.view.WindowManagerImpl in project android_frameworks_base by ResurrectionRemix.

the class Presentation method createPresentationContext.

private static Context createPresentationContext(Context outerContext, Display display, int theme) {
    if (outerContext == null) {
        throw new IllegalArgumentException("outerContext must not be null");
    }
    if (display == null) {
        throw new IllegalArgumentException("display must not be null");
    }
    Context displayContext = outerContext.createDisplayContext(display);
    if (theme == 0) {
        TypedValue outValue = new TypedValue();
        displayContext.getTheme().resolveAttribute(com.android.internal.R.attr.presentationTheme, outValue, true);
        theme = outValue.resourceId;
    }
    // Derive the display's window manager from the outer window manager.
    // We do this because the outer window manager have some extra information
    // such as the parent window, which is important if the presentation uses
    // an application window type.
    final WindowManagerImpl outerWindowManager = (WindowManagerImpl) outerContext.getSystemService(Context.WINDOW_SERVICE);
    final WindowManagerImpl displayWindowManager = outerWindowManager.createPresentationWindowManager(displayContext);
    return new ContextThemeWrapper(displayContext, theme) {

        @Override
        public Object getSystemService(String name) {
            if (Context.WINDOW_SERVICE.equals(name)) {
                return displayWindowManager;
            }
            return super.getSystemService(name);
        }
    };
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) WindowManagerImpl(android.view.WindowManagerImpl) TypedValue(android.util.TypedValue)

Aggregations

WindowManagerImpl (android.view.WindowManagerImpl)11 Context (android.content.Context)6 TypedValue (android.util.TypedValue)6 ContextThemeWrapper (android.view.ContextThemeWrapper)6