Fix pip mode for pad

pull/586/head
FongMi 2 years ago
parent f127d1c88c
commit 8de35a7e9d
  1. 6
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  2. 18
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java

@ -209,7 +209,11 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
mBinding.control.action.decode.setText(mPlayers.getDecodeText());
mBinding.control.action.speed.setEnabled(mPlayers.canAdjustSpeed());
mBinding.control.action.home.setVisibility(LiveConfig.isOnly() ? View.GONE : View.VISIBLE);
mBinding.video.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> mPiP.update(getActivity(), view));
mBinding.video.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
if (left != oldLeft || right != oldRight || top != oldTop || bottom != oldBottom) {
mPiP.update(getActivity(), view);
}
});
}
private void setSubtitleView() {

@ -367,12 +367,15 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
private void setVideoView() {
mPlayers.setup(mBinding.exo);
if (isPort() && ResUtil.isLand(this)) enterFullscreen();
mBinding.control.action.decode.setText(mPlayers.getDecodeText());
mBinding.control.action.speed.setEnabled(mPlayers.canAdjustSpeed());
mBinding.control.action.reset.setText(ResUtil.getStringArray(R.array.select_reset)[Setting.getReset()]);
mBinding.video.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> mPiP.update(getActivity(), view));
if (mControlDialog != null && mControlDialog.isVisible()) mControlDialog.setPlayer();
if (isPort() && ResUtil.isLand(this)) enterFullscreen();
mBinding.video.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
if (left != oldLeft || right != oldRight || top != oldTop || bottom != oldBottom) {
mPiP.update(getActivity(), view);
}
});
}
private void setSubtitleView() {
@ -1279,6 +1282,13 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
mPlayers.play();
}
private void setVideoMargins(int margin) {
if (!ResUtil.isPad() || isFullscreen()) return;
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mBinding.video.getLayoutParams();
params.setMargins(margin, margin, margin, margin);
mBinding.video.setLayoutParams(params);
}
public boolean isForeground() {
return foreground;
}
@ -1495,6 +1505,7 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
super.onPictureInPictureModeChanged(isInPictureInPictureMode);
if (isInPictureInPictureMode) {
PlaybackService.start(mPlayers);
setVideoMargins(0);
setSubtitle(10);
hideControl();
hideSheet();
@ -1502,6 +1513,7 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
setForeground(true);
PlaybackService.stop();
setSubtitle(Setting.getSubtitle());
setVideoMargins(ResUtil.dp2px(16));
if (isStop()) finish();
}
}

Loading…
Cancel
Save