1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| public Presentation(@NonNull Context outerContext, @NonNull Display display, int theme, @WindowType int type) { super(createPresentationContext(outerContext, display, theme, type), theme, false);
mDisplay = display; mDisplayManager = getContext().getSystemService(DisplayManager.class);
final Window w = getWindow(); final WindowManager.LayoutParams attr = w.getAttributes(); w.setAttributes(attr); w.setGravity(Gravity.FILL); w.setType(getWindowType(type, display)); setCanceledOnTouchOutside(false); }
private static Context createPresentationContext( Context outerContext, Display display, int theme, @WindowType int type) { if (outerContext == null) { throw new IllegalArgumentException("outerContext must not be null"); } if (display == null) { throw new IllegalArgumentException("display must not be null"); }
Context windowContext = outerContext.createDisplayContext(display) .createWindowContext(getWindowType(type, display), null ); if (theme == 0) { TypedValue outValue = new TypedValue(); windowContext.getTheme().resolveAttribute( com.android.internal.R.attr.presentationTheme, outValue, true); theme = outValue.resourceId; } return new ContextThemeWrapper(windowContext, theme); }
|