From 05595b7b4e854ef18230fdf1884a9b6c46424b8b Mon Sep 17 00:00:00 2001 From: dhk2 Date: Fri, 3 Jul 2020 14:49:02 -0700 Subject: [PATCH] adding controls to exit pip or switch to background audio --- .../net/schueller/peertube/activity/VideoPlayActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java b/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java index cd424dc..6c16c75 100644 --- a/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java @@ -175,7 +175,7 @@ public class VideoPlayActivity extends AppCompatActivity { if (isLandscape) { 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.height = FrameLayout.LayoutParams.MATCH_PARENT; videoPlayerFragment.getView().setLayoutParams(params); @@ -368,8 +368,8 @@ public class VideoPlayActivity extends AppCompatActivity { @RequiresApi(api = Build.VERSION_CODES.O) @Override public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) { - VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment) - getSupportFragmentManager().findFragmentById(R.id.video_player_fragment); + FragmentManager fragmentManager = getSupportFragmentManager(); + VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment) fragmentManager.findFragmentById(R.id.video_player_fragment); if (isInPictureInPictureMode) { videoPlayerFragment.showControls(false);