Android Window - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Window class.

This code example shows how to use the following methods:setBackgroundColor, setLayoutParams, setVisibility, addView, addContentView
This code example shows how to use the following methods:getAction, getActionIndex, getActionMasked, getX, obtainNoHistory
    } 
 
    @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);
        } 
 

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setBackgroundColor, addView, setContentView, setGravity
  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);
  } 
} 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addFlags, getAttributes, setAttributes
 
        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();
    } 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addFlags, getAttributes, setAttributes
 
        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();
    } 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setBackgroundDrawable
    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);
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getDecorView
                    } 
                } 
            } 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);
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setAlpha, setBackgroundDrawable
                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(); 
    } 
 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getAttributes, setAttributes
        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) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setUiOptions
    } 
 
    @TargetApi(14) 
    public static void setUiOptions(Window window, int uiOptions) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            window.setUiOptions(uiOptions);
        } 
    } 
         
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android Window Questions & Answers:

See Code Examples for Android Window Methods: