Java Code Examples for android.view.SurfaceView#setZOrderOnTop()

The following examples show how to use android.view.SurfaceView#setZOrderOnTop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShootActivity.java    From TimeLapse with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    log("onCreate");

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_shoot);

    Intent intent = getIntent();
    settings = Settings.getFromIntent(intent);

    shotCount = 0;
    takingPicture = false;
    burstShooting = settings.interval == 0;

    tvCount = (TextView) findViewById(R.id.tvCount);
    tvBattery = (TextView) findViewById(R.id.tvBattery);
    tvRemaining = (TextView) findViewById(R.id.tvRemaining);
    llEnd = (LinearLayout) findViewById(R.id.llEnd);

    reviewSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
    reviewSurfaceView.setZOrderOnTop(false);
    cameraSurfaceHolder = reviewSurfaceView.getHolder();
    cameraSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
 
Example 2
Source File: MultiSurfaceActivity.java    From pause-resume-video-recording with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_multi_surface_test);

    // #1 is at the bottom; mark it as secure just for fun.  By default, this will use
    // the RGB565 color format.
    mSurfaceView1 = (SurfaceView) findViewById(R.id.multiSurfaceView1);
    mSurfaceView1.getHolder().addCallback(this);
    mSurfaceView1.setSecure(true);

    // #2 is above it, in the "media overlay"; must be translucent or we will totally
    // obscure #1 and it will be ignored by the compositor.  The addition of the alpha
    // plane should switch us to RGBA8888.
    mSurfaceView2 = (SurfaceView) findViewById(R.id.multiSurfaceView2);
    mSurfaceView2.getHolder().addCallback(this);
    mSurfaceView2.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    mSurfaceView2.setZOrderMediaOverlay(true);

    // #3 is above everything, including the UI.  Also translucent.
    mSurfaceView3 = (SurfaceView) findViewById(R.id.multiSurfaceView3);
    mSurfaceView3.getHolder().addCallback(this);
    mSurfaceView3.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    mSurfaceView3.setZOrderOnTop(true);
}
 
Example 3
Source File: MultiSurfaceActivity.java    From grafika with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_multi_surface_test);

    // #1 is at the bottom; mark it as secure just for fun.  By default, this will use
    // the RGB565 color format.
    mSurfaceView1 = (SurfaceView) findViewById(R.id.multiSurfaceView1);
    mSurfaceView1.getHolder().addCallback(this);
    mSurfaceView1.setSecure(true);

    // #2 is above it, in the "media overlay"; must be translucent or we will totally
    // obscure #1 and it will be ignored by the compositor.  The addition of the alpha
    // plane should switch us to RGBA8888.
    mSurfaceView2 = (SurfaceView) findViewById(R.id.multiSurfaceView2);
    mSurfaceView2.getHolder().addCallback(this);
    mSurfaceView2.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    mSurfaceView2.setZOrderMediaOverlay(true);

    // #3 is above everything, including the UI.  Also translucent.
    mSurfaceView3 = (SurfaceView) findViewById(R.id.multiSurfaceView3);
    mSurfaceView3.getHolder().addCallback(this);
    mSurfaceView3.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    mSurfaceView3.setZOrderOnTop(true);
}
 
Example 4
Source File: PjSipVideo.java    From react-native-sip with GNU General Public License v3.0 5 votes vote down vote up
public PjSipVideo(Context context) {
    super(context);

    surfaceView = new SurfaceView(context);
    surfaceView.getHolder().addCallback(this);
    surfaceView.setZOrderOnTop(false);
    addView(surfaceView);
}
 
Example 5
Source File: PjSipVideo.java    From react-native-pjsip with GNU General Public License v3.0 5 votes vote down vote up
public PjSipVideo(Context context) {
    super(context);

    surfaceView = new SurfaceView(context);
    surfaceView.getHolder().addCallback(this);
    surfaceView.setZOrderOnTop(false);
    addView(surfaceView);
}
 
Example 6
Source File: CallVideoFragment.java    From Linphone4Android with GNU General Public License v3.0 4 votes vote down vote up
private void fixZOrder(SurfaceView video, SurfaceView preview) {
	video.setZOrderOnTop(false);
	preview.setZOrderOnTop(true);
	preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
}
 
Example 7
Source File: MultiVideoCallActivity.java    From sealtalk-android with MIT License 4 votes vote down vote up
public void onSwitchRemoteUsers(View view) {
    String from = (String) view.getTag();
    if (from == null)
        return;
    String to = (String) localView.getTag();
    FrameLayout layout = (FrameLayout) view;
    SurfaceView fromView = (SurfaceView) layout.getChildAt(0);
    SurfaceView toView = localView;

    localViewContainer.removeAllViews();
    layout.removeAllViews();

    View singleRemoteView = remoteViewContainer.findViewWithTag(from + "view");
    UserInfo toUserInfo = RongContext.getInstance().getUserInfoFromCache(to);
    UserInfo fromUserInfo = RongContext.getInstance().getUserInfoFromCache(from);

    AsyncImageView userPortraitView = (AsyncImageView) singleRemoteView.findViewById(R.id.user_portrait);
    TextView backUserNameView = (TextView) singleRemoteView.findViewById(R.id.user_name);

    if (toUserInfo != null) {
        if (toUserInfo.getPortraitUri() != null) {
            userPortraitView.setAvatar(toUserInfo.getPortraitUri().toString(), R.drawable.rc_default_portrait);
        }
        backUserNameView.setText(toUserInfo.getName());
    } else {
        backUserNameView.setText(to);
    }
    singleRemoteView.setTag(to + "view");
    fromView.setZOrderOnTop(false);
    fromView.setZOrderMediaOverlay(false);
    localViewContainer.addView(fromView);
    toView.setZOrderOnTop(true);
    toView.setZOrderMediaOverlay(true);
    layout.addView(toView);

    TextView topUserNameView = (TextView) topContainer.findViewById(R.id.rc_voip_user_name);
    if (fromUserInfo != null) {
        topUserNameView.setText(fromUserInfo.getName());
    } else {
        topUserNameView.setText(from);
    }
    layout.setTag(to);
    localView = fromView;
    localView.setTag(from);
    localViewUserId = from;
}