adding controls to exit pip or switch to background audio

This commit is contained in:
dhk2 2020-07-03 14:49:02 -07:00
parent 61aa0e379b
commit 05595b7b4e

View File

@ -175,7 +175,7 @@ public class VideoPlayActivity extends AppCompatActivity {
if (isLandscape) { if (isLandscape) {
assert videoPlayerFragment != null; assert videoPlayerFragment != null;
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) videoPlayerFragment.requireView().getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) Objects.requireNonNull(videoPlayerFragment.getView()).getLayoutParams();
params.width = FrameLayout.LayoutParams.MATCH_PARENT; params.width = FrameLayout.LayoutParams.MATCH_PARENT;
params.height = FrameLayout.LayoutParams.MATCH_PARENT; params.height = FrameLayout.LayoutParams.MATCH_PARENT;
videoPlayerFragment.getView().setLayoutParams(params); videoPlayerFragment.getView().setLayoutParams(params);
@ -368,8 +368,8 @@ public class VideoPlayActivity extends AppCompatActivity {
@RequiresApi(api = Build.VERSION_CODES.O) @RequiresApi(api = Build.VERSION_CODES.O)
@Override @Override
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) { public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment) FragmentManager fragmentManager = getSupportFragmentManager();
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment); VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment) fragmentManager.findFragmentById(R.id.video_player_fragment);
if (isInPictureInPictureMode) { if (isInPictureInPictureMode) {
videoPlayerFragment.showControls(false); videoPlayerFragment.showControls(false);