Example usage for android.view SurfaceView setZOrderOnTop

List of usage examples for android.view SurfaceView setZOrderOnTop

Introduction

In this page you can find the example usage for android.view SurfaceView setZOrderOnTop.

Prototype

public void setZOrderOnTop(boolean onTop) 

Source Link

Document

Control whether the surface view's surface is placed on top of its window.

Usage

From source file:com.sim2dial.dialer.VideoCallFragment.java

private void fixZOrder(SurfaceView video, SurfaceView preview) {
    video.setZOrderOnTop(false);
    preview.setZOrderOnTop(true);//from ww  w.  j a  v a  2s.  c  om
    preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
}

From source file:org.mozilla.gecko.GeckoApp.java

void addPluginView(final View view, final int x, final int y, final int w, final int h, final String metadata) {
    mMainHandler.post(new Runnable() {
        public void run() {
            PluginLayoutParams lp;/*  ww w.  j  a va  2s .  c  om*/

            Tabs tabs = Tabs.getInstance();
            Tab tab = tabs.getSelectedTab();

            if (tab == null)
                return;

            ViewportMetrics targetViewport = mLayerController.getViewportMetrics();
            ViewportMetrics pluginViewport;

            try {
                JSONObject viewportObject = new JSONObject(metadata);
                pluginViewport = new ViewportMetrics(viewportObject);
            } catch (JSONException e) {
                Log.e(LOGTAG, "Bad viewport metadata: ", e);
                return;
            }

            if (mPluginContainer.indexOfChild(view) == -1) {
                lp = new PluginLayoutParams(x, y, w, h, pluginViewport);

                view.setWillNotDraw(false);
                if (view instanceof SurfaceView) {
                    SurfaceView sview = (SurfaceView) view;

                    sview.setZOrderOnTop(false);
                    sview.setZOrderMediaOverlay(true);
                }

                mPluginContainer.addView(view, lp);
                tab.addPluginView(view);
            } else {
                lp = (PluginLayoutParams) view.getLayoutParams();
                lp.reset(x, y, w, h, pluginViewport);
                lp.reposition(targetViewport);
                try {
                    mPluginContainer.updateViewLayout(view, lp);
                    view.setVisibility(View.VISIBLE);
                } catch (IllegalArgumentException e) {
                    Log.i(LOGTAG, "e:" + e);
                    // it can be the case where we
                    // get an update before the view
                    // is actually attached.
                }
            }
        }
    });
}