These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Window class.
Activity activity = tiWebView.getProxy().getActivity(); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); if (activity instanceof TiBaseActivity) { if (mCustomViewContainer == null) { mCustomViewContainer = new FrameLayout(activity); mCustomViewContainer.setBackgroundColor(Color.BLACK); mCustomViewContainer.setLayoutParams(params); activity.getWindow().addContentView(mCustomViewContainer, params); } mCustomViewContainer.addView(view); mCustomView = view; mCustomViewCallback = callback; mCustomViewContainer.setVisibility(View.VISIBLE); } } @Override public void onHideCustomView() {
} @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (mWallpaperConnection != null && mWallpaperConnection.mEngine != null) { MotionEvent dup = MotionEvent.obtainNoHistory(ev); try { mWallpaperConnection.mEngine.dispatchPointer(dup); } catch (RemoteException e) { } } if (ev.getAction() == MotionEvent.ACTION_DOWN) { onUserInteraction(); } boolean handled = getWindow().superDispatchTouchEvent(ev); if (!handled) { handled = onTouchEvent(ev); }
protected AndroidPlatform platform() { return platform; } protected void setContentView(GameViewGL view) { LinearLayout layout = new LinearLayout(this); layout.setBackgroundColor(0xFF000000); layout.setGravity(Gravity.CENTER); layout.addView(gameView); LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); getWindow().setContentView(layout, params); } }
dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); } @Override public void onCreate() { super.onCreate(); mImm = InputMethodManagerCompatWrapper.getInstance(); }
dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); } @Override public void onCreate() { super.onCreate(); mImm = InputMethodManagerCompatWrapper.getInstance(); }
float mSeekValue = .5f; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000)); SeekBar slider = new SeekBar(this); LinearLayout container = new LinearLayout(this); container.setOrientation(LinearLayout.VERTICAL); setContentView(container); container.addView(slider); slider.setMax(100); slider.setProgress(50); FrameLayout frame = new FrameLayout(this); final RenderingView gpuView = new RenderingView(this, Color.GREEN); frame.addView(gpuView); final RenderingView swView = new RenderingView(this, Color.RED); swView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); frame.addView(swView);
} } } else if (event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()) { Window win = mDialog.getWindow(); if (win != null) { View decor = win.getDecorView(); if (decor != null) { KeyEvent.DispatcherState ds = decor.getKeyDispatcherState(); if (ds != null && ds.isTracking(event)) { mMenu.close(true); dialog.dismiss(); return true; } } } } } // Menu shortcut matching return mMenu.performShortcut(keyCode, event, 0);
int bgWidth = (int)(((float)b.getHeight()) * ratio); b = Bitmap.createBitmap(b, 0, 0,Math.min(b.getWidth(),bgWidth),bgHeight); mThemeDrawable = new BitmapDrawable(b); mThemeDrawable.setAlpha(200); } activity.getWindow().setBackgroundDrawable(mThemeDrawable); } } @Override protected void onResume() { ((ImApp)this.getApplication()).setAppTheme(this); super.onResume(); }
updateValueText(); } private void updateBrightness() { if (mWindow != null) { LayoutParams params = mWindow.getAttributes(); params.buttonBrightness = (float) mSeekBar.getProgress() / 100; mWindow.setAttributes(params); } } private void updateValueText() { if (mValueText != null) { String text = String.valueOf(mSeekBar.getProgress()) + "%"; mValueText.setText(text); } } @Override public void onStartTrackingTouch(SeekBar seek) {
} @TargetApi(14) public static void setUiOptions(Window window, int uiOptions) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { window.setUiOptions(uiOptions); } } }