Java 类android.app.PictureInPictureParams 实例源码

项目:moonlight-android    文件:Game.java   
@Override
public void onUserLeaveHint() {
    super.onUserLeaveHint();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        if (prefConfig.enablePip && connected) {
            enterPictureInPictureMode(
                    new PictureInPictureParams.Builder()
                            .setAspectRatio(new Rational(prefConfig.width, prefConfig.height))
                            .setSourceRectHint(new Rect(
                                    streamView.getLeft(), streamView.getTop(),
                                    streamView.getRight(), streamView.getBottom()))
                            .build());
        }
    }
}
项目:Android-O-Sample    文件:PipActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pip_test);

    mFramePlayer = findViewById(R.id.frame_mock_player);
    mBtnPip = findViewById(R.id.btn_minimize);

    mBtnPip.setOnClickListener(view -> {
        if (android.os.Build.VERSION.SDK_INT >= 26) {
            //Trigger PiP mode
            try {
                Rational rational = new Rational(mFramePlayer.getWidth(), mFramePlayer.getHeight());

                PictureInPictureParams mParams =
                        new PictureInPictureParams.Builder()
                                .setAspectRatio(rational)
                                .build();

                enterPictureInPictureMode(mParams);
            } catch (IllegalStateException e) {
                e.printStackTrace();
            }
        } else {
            Toast.makeText(PipActivity.this, "API 26 needed to perform PiP", Toast.LENGTH_SHORT).show();
        }
    });

}
项目:Android-O-Feature    文件:PictureInPictureActivity.java   
private View.OnClickListener onPictureInPictureClick() {
    return view -> {
        if (exoPlayer != null && exoPlayer.getPlaybackState() == SimpleExoPlayer.STATE_READY) {
            int videoWidth = exoPlayer.getVideoFormat().width;
            int videoHeight = exoPlayer.getVideoFormat().height;
            PictureInPictureParams params = new PictureInPictureParams.Builder()
                    .setAspectRatio(new Rational(videoWidth, videoHeight))
                    .build();
            enterPictureInPictureMode(params);
        } else {
            Toast.makeText(PictureInPictureActivity.this, R.string.video_playback_not_ready, Toast.LENGTH_SHORT).show();
        }
    };
}
项目:Camera-Roll-Android-App    文件:VideoPlayerActivity.java   
@Override
protected void onPause() {
    super.onPause();
    if (player.getPlayWhenReady() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        PictureInPictureParams params = new PictureInPictureParams.Builder()
                .build();
        enterPictureInPictureMode(params);
    }
}
项目:CompositeAndroid    文件:ActivityPlugin.java   
boolean enterPictureInPictureMode(final CallFun1<Boolean, PictureInPictureParams> superCall,
        final PictureInPictureParams params) {
    synchronized (mSuperListeners) {
        mSuperListeners.push(superCall);
        return enterPictureInPictureMode(params);
    }
}
项目:CompositeAndroid    文件:ActivityPlugin.java   
void setPictureInPictureParams(final CallVoid1<PictureInPictureParams> superCall,
        final PictureInPictureParams params) {
    synchronized (mSuperListeners) {
        mSuperListeners.push(superCall);
        setPictureInPictureParams(params);
    }
}
项目:Agora-Picture-in-Picture-Android    文件:VideoChatViewActivity.java   
public void onEnterIntoPIPClicked(View view) {
    PictureInPictureParams params = new PictureInPictureParams.Builder()
            .setAspectRatio(new Rational(10, 16)) // Portrait Aspect Ratio
            .build();
    enterPictureInPictureMode(params);
}
项目:CompositeAndroid    文件:BlueprintActivity.java   
@Override
public boolean enterPictureInPictureMode(final PictureInPictureParams params) {
    return super.enterPictureInPictureMode(params);
}
项目:CompositeAndroid    文件:BlueprintActivity.java   
@Override
public void setPictureInPictureParams(final PictureInPictureParams params) {
    super.setPictureInPictureParams(params);
}
项目:CompositeAndroid    文件:CompositeActivity.java   
@Override
public boolean enterPictureInPictureMode(final PictureInPictureParams params) {
    return delegate.enterPictureInPictureMode(params);
}
项目:CompositeAndroid    文件:CompositeActivity.java   
@Override
public void setPictureInPictureParams(final PictureInPictureParams params) {
    delegate.setPictureInPictureParams(params);
}
项目:CompositeAndroid    文件:CompositeActivity.java   
@Override
public boolean super_enterPictureInPictureMode(final PictureInPictureParams params) {
    return super.enterPictureInPictureMode(params);
}
项目:CompositeAndroid    文件:CompositeActivity.java   
@Override
public void super_setPictureInPictureParams(final PictureInPictureParams params) {
    super.setPictureInPictureParams(params);
}
项目:CompositeAndroid    文件:ActivityPlugin.java   
public boolean enterPictureInPictureMode(final PictureInPictureParams params) {
    verifyMethodCalledFromDelegate("enterPictureInPictureMode(PictureInPictureParams)");
    return ((CallFun1<Boolean, PictureInPictureParams>) mSuperListeners.pop()).call(params);
}
项目:CompositeAndroid    文件:ActivityPlugin.java   
public void setPictureInPictureParams(final PictureInPictureParams params) {
    verifyMethodCalledFromDelegate("setPictureInPictureParams(PictureInPictureParams)");
    ((CallVoid1<PictureInPictureParams>) mSuperListeners.pop()).call(params);
}
项目:opentok-android-sdk-samples    文件:MainActivity.java   
public void pipActivity(View view) {
    PictureInPictureParams params = new PictureInPictureParams.Builder()
            .setAspectRatio(new Rational(9,16)) // Portrait Aspect Ratio
            .build();
    enterPictureInPictureMode(params);
}
项目:CompositeAndroid    文件:ICompositeActivity.java   
boolean enterPictureInPictureMode(final PictureInPictureParams params);
项目:CompositeAndroid    文件:ICompositeActivity.java   
void setPictureInPictureParams(final PictureInPictureParams params);
项目:CompositeAndroid    文件:ICompositeActivity.java   
boolean super_enterPictureInPictureMode(final PictureInPictureParams params);
项目:CompositeAndroid    文件:ICompositeActivity.java   
void super_setPictureInPictureParams(final PictureInPictureParams params);