adding controls to exit pip or switch to background audio

This commit is contained in:
dhk2 2020-07-03 14:41:09 -07:00
parent ae058167b6
commit f04c64a60d
3 changed files with 7 additions and 3 deletions

View File

@ -70,6 +70,8 @@ import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
public class VideoPlayActivity extends AppCompatActivity { public class VideoPlayActivity extends AppCompatActivity {
private static final String TAG = "VideoPlayActivity"; private static final String TAG = "VideoPlayActivity";
private static boolean floatMode = false; private static boolean floatMode = false;
private static final int REQUEST_CODE = 101; private static final int REQUEST_CODE = 101;
private BroadcastReceiver receiver; private BroadcastReceiver receiver;
@ -171,7 +173,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);
@ -186,7 +188,7 @@ public class VideoPlayActivity extends AppCompatActivity {
} else { } else {
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 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 250, getResources().getDisplayMetrics()); params.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 250, getResources().getDisplayMetrics());
videoPlayerFragment.getView().setLayoutParams(params); videoPlayerFragment.getView().setLayoutParams(params);
@ -388,6 +390,7 @@ public class VideoPlayActivity extends AppCompatActivity {
if (action.equals(ACTION_PLAY)){ if (action.equals(ACTION_PLAY)){
videoPlayerFragment.pauseToggle(); videoPlayerFragment.pauseToggle();
} }
*/
if (action.equals(BACKGROUND_AUDIO)) { if (action.equals(BACKGROUND_AUDIO)) {
unregisterReceiver(receiver); unregisterReceiver(receiver);
finish(); finish();

View File

@ -270,7 +270,7 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
public void stopVideo() { public void stopVideo() {
if (mBound) { if (mBound) {
requireContext().unbindService(mConnection); Objects.requireNonNull(getContext()).unbindService(mConnection);
mBound = false; mBound = false;
} }
} }

View File

@ -3,6 +3,7 @@
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="true"
card_view:cardCornerRadius="0dp" card_view:cardCornerRadius="0dp"
card_view:cardElevation="0dp" card_view:cardElevation="0dp"
card_view:contentPadding="0dp" card_view:contentPadding="0dp"