Example usage for android.graphics PixelFormat TRANSLUCENT

List of usage examples for android.graphics PixelFormat TRANSLUCENT

Introduction

In this page you can find the example usage for android.graphics PixelFormat TRANSLUCENT.

Prototype

int TRANSLUCENT

To view the source code for android.graphics PixelFormat TRANSLUCENT.

Click Source Link

Document

System chooses a format that supports translucency (many alpha bits)

Usage

From source file:com.doomy.library.Internal.PopupIndicator.java

private WindowManager.LayoutParams createPopupLayout(IBinder token) {
    WindowManager.LayoutParams p = new WindowManager.LayoutParams();
    p.gravity = Gravity.START | Gravity.TOP;
    p.width = ViewGroup.LayoutParams.MATCH_PARENT;
    p.height = ViewGroup.LayoutParams.MATCH_PARENT;
    p.format = PixelFormat.TRANSLUCENT;
    p.flags = computeFlags(p.flags);/*from  w w w  . j  a  v a2s.  co m*/
    p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
    p.token = token;
    p.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
    p.setTitle("DiscreteSeekBar Indicator:" + Integer.toHexString(hashCode()));

    return p;
}

From source file:com.hrs.filltheform.dialog.FillTheFormDialog.java

private void prepareDialogView() {
    windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    dialogParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_PHONE,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT);

    dialogView = new FrameLayout(context);
    dialogView.setOnTouchListener(new View.OnTouchListener() {
        final Point screenSize = new Point();

        @Override/*from  w w w  .  j  ava2s.com*/
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                windowManager.getDefaultDisplay().getSize(screenSize);
                model.setScreenDimensions(screenSize.x, screenSize.y);
                model.setInitialDialogPosition(dialogParams.x, dialogParams.y);
                model.setInitialTouchEvent(event.getRawX(), event.getRawY());
                return true;
            case MotionEvent.ACTION_UP:
                model.onActionUp();
                return true;
            case MotionEvent.ACTION_MOVE:
                model.onActionMove(event.getRawX(), event.getRawY());
                return true;
            }
            return false;
        }
    });

    @SuppressLint("InflateParams")
    final View dialogContent = LayoutInflater.from(context).inflate(R.layout.dialog, null);
    dialogMenu = dialogContent.findViewById(R.id.dialog_menu);
    expandIcon = dialogContent.findViewById(R.id.expand_icon);
    expandIconFastMode = dialogContent.findViewById(R.id.expand_icon_fast_mode);

    // Set up dialog content
    ImageButton closeButton = (ImageButton) dialogContent.findViewById(R.id.close_button);
    closeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            model.onCloseButtonClicked();
        }
    });
    ImageButton minimizeButton = (ImageButton) dialogContent.findViewById(R.id.minimize_button);
    minimizeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            model.onMinimizeButtonClicked();
        }
    });
    ImageButton openFillTheFormAppButton = (ImageButton) dialogContent
            .findViewById(R.id.open_fill_the_form_app_button);
    openFillTheFormAppButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            model.onOpenFillTheFormAppButtonClicked();
        }
    });
    fastModeButton = (ImageButton) dialogContent.findViewById(R.id.fast_mode_button);
    fastModeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            model.toggleFastMode();
        }
    });

    // Configuration items list
    configurationItemsView = (RecyclerView) dialogContent.findViewById(R.id.configuration_items_view);
    configurationItemsView.setHasFixedSize(true);
    configurationItemsView.setLayoutManager(new LinearLayoutManager(context));
    // Set adapter
    configurationItemsAdapter = new ConfigurationItemsAdapter(context, model);
    configurationItemsView.setAdapter(configurationItemsAdapter);
    dialogView.addView(dialogContent);
}

From source file:com.rodrigopontes.androidbubbles.BubblesManager.java

/**
 * Adds new Bubble to BubblesManager/* w ww.  ja  v a  2 s.co m*/
 */
public void addBubble(Bubble bubble) {
    if (windowManager != null) {
        WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                        | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
                PixelFormat.TRANSLUCENT);
        params.gravity = Gravity.TOP | Gravity.START;
        params.y = screenHeight / BubblesProperties.BUBBLE_ENTER_Y_POSITION;
        BubbleController bubbleController = new BubbleController(bubble, params);
        bubble.getFrameLayout().setOnTouchListener(bubbleController.new BubbleTouchListener());
        bubblesList.add(bubbleController);
        windowManager.addView(bubble.getFrameLayout(), params);
        bubbleController.createdAnimation = new SpringAnimation(
                new AnimationPosition(BubblesProperties.MODE_STATIC_POSITION,
                        screenWidth + BubblesProperties.BUBBLE_ENTER_SPEED),
                new AnimationPosition(BubblesProperties.MODE_STATIC_POSITION, screenWidth
                        - (int) (bubbleController.bubbleWidth * BubblesProperties.BUBBLE_EDGE_OFFSET_RIGHT)),
                params, BubblesProperties.AXIS_X, BubblesProperties.SPRING_ANIMATION_LONG_DURATION, bubble)
                        .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else {
        throw new NullPointerException("BubblesManager has not yet been created! Use .create() first.");
    }
}

From source file:com.example.accessibility.OverlayManager.java

void createOverlayView(Context context) {
    //The overlay with global buttons that listens touch events is created here. It's a ListenerView.

    mContext = context;//from w ww .  ja v  a  2s .  co  m
    // ////////////////////////////////////////////////////////////////////////////////
    // ListenerView
    LayoutParams listenerParams = new LayoutParams();
    listenerParams.setTitle("OverlayManager");

    // Set a transparent background
    listenerParams.format = PixelFormat.TRANSLUCENT;

    // Create an always on top type of window:
    //  TYPE_SYSTEM_ALERT   = touch events are intercepted
    listenerParams.type = LayoutParams.TYPE_SYSTEM_ALERT | LayoutParams.TYPE_PHONE
            | LayoutParams.TYPE_SYSTEM_OVERLAY;

    // The whole screen is covered (including status bar)
    listenerParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_LAYOUT_IN_SCREEN;
    // ////////////////////////////////////////////////////////////////////////////////

    showScrollButtons();

    WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);

    if (mLV == null) {
        mLV = new ListenerView(this.getApplicationContext());
        //LV.setTouchable(true);
        mLV.setOnTouchListener(this);
        wm.addView(mLV, listenerParams);
    }
    Log.i("prints", "acaba createOverlayView del Overlay");
}

From source file:org.cocos2dx.lib.TextInputWraper.java

protected void initView() {
    setEGLConfigChooser(8, 8, 8, 8, 16, 0);
    setZOrderOnTop(true);//w  w  w  . ja  v a 2  s  .c  o  m
    getHolder().setFormat(PixelFormat.TRANSLUCENT);
    setFocusableInTouchMode(true);

    textInputWraper = new TextInputWraper(this);

    handler = new Handler() {
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case HANDLER_OPEN_IME_KEYBOARD:
                if (null != mTextField && mTextField.requestFocus()) {
                    mTextField.removeTextChangedListener(textInputWraper);
                    mTextField.setText("");
                    String text = (String) msg.obj;
                    mTextField.append(text);
                    textInputWraper.setOriginText(text);
                    mTextField.addTextChangedListener(textInputWraper);
                    InputMethodManager imm = (InputMethodManager) mainView.getContext()
                            .getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.showSoftInput(mTextField, 0);
                    Log.d("GLSurfaceView", "showSoftInput");
                }
                break;

            case HANDLER_CLOSE_IME_KEYBOARD:
                if (null != mTextField) {
                    mTextField.removeTextChangedListener(textInputWraper);
                    InputMethodManager imm = (InputMethodManager) mainView.getContext()
                            .getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(mTextField.getWindowToken(), 0);
                    Log.d("GLSurfaceView", "HideSoftInput");
                }
                break;
            }
        }
    };

    mainView = this;
}

From source file:org.n52.geoar.GeoARActivity.java

@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    Window window = getWindow();
    window.setFormat(PixelFormat.TRANSLUCENT);
}

From source file:com.cn21.speedtest.service.LogService.java

private void createSystemWindow() {
    final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
            //WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
            0, PixelFormat.TRANSLUCENT);
    final LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    mLogListView = (ListView) inflator.inflate(R.layout.window_log, null);
    mLogBuffer = new LinkedList<LogLine>();
    mLogBufferFiltered = new LinkedList<LogLine>();
    mAdapter = new LogAdapter(this, mLogBufferFiltered);
    mLogListView.setAdapter(mAdapter);/*from   www. jav a 2  s . co m*/
    wm.addView(mLogListView, lp);
}

From source file:com.readystatesoftware.ghostlog.LogService.java

private void createSystemWindow() {
    final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
            //WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
            0, PixelFormat.TRANSLUCENT);

    final LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    mLogListView = (ListView) inflator.inflate(R.layout.window_log, null);
    setSystemViewBackground();// w  ww . jav a2  s .  c om
    mLogBuffer = new LinkedList<LogLine>();
    mLogBufferFiltered = new LinkedList<LogLine>();
    mAdapter = new LogAdapter(this, mLogBufferFiltered);
    mLogListView.setAdapter(mAdapter);
    wm.addView(mLogListView, lp);
}

From source file:com.example.piechart3d.PieChart3DView.java

/**
 * <b>public void register()</b><br/>
 * <br/>//from   w  w  w . jav  a2 s  . c  o  m
 * Registers PieChart3DView. It's needed to be called in
 * activity's onResume() method.<br/>
 * 
 * @see {@link #unregister()}
 * 
 * */
public void register() {
    if (!set) {
        setEGLConfigChooser(8, 8, 8, 8, 16, 0);
        setRenderer(mRenderer);
        getHolder().setFormat(PixelFormat.TRANSLUCENT);
        setZOrderOnTop(true);
        set = true;
    }
}

From source file:name.gudong.translate.listener.view.TipViewController.java

private WindowManager.LayoutParams getPopViewParams() {
    int w = WindowManager.LayoutParams.MATCH_PARENT;
    int h = WindowManager.LayoutParams.WRAP_CONTENT;

    int flags = 0;
    int type;/*from   w  w  w  .j av a2  s. c o m*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        type = WindowManager.LayoutParams.TYPE_TOAST;
    } else {
        type = WindowManager.LayoutParams.TYPE_PHONE;
    }

    WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(w, h, type, flags,
            PixelFormat.TRANSLUCENT);
    layoutParams.gravity = Gravity.TOP;
    layoutParams.format = PixelFormat.RGBA_8888;
    layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
            | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

    layoutParams.gravity = Gravity.CENTER | Gravity.TOP;
    layoutParams.x = 0;
    layoutParams.y = 0;
    return layoutParams;
}