pull/586/head
FongMi 2 years ago
parent cca7bbe23d
commit 64f446cc9c
  1. 6
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  2. 24
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java

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

@ -371,11 +371,14 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
mBinding.control.action.decode.setText(mPlayers.getDecodeText()); mBinding.control.action.decode.setText(mPlayers.getDecodeText());
mBinding.control.action.speed.setEnabled(mPlayers.canAdjustSpeed()); mBinding.control.action.speed.setEnabled(mPlayers.canAdjustSpeed());
mBinding.control.action.reset.setText(ResUtil.getStringArray(R.array.select_reset)[Setting.getReset()]); 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) -> { mBinding.video.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> mPiP.update(getActivity(), view));
if (left != oldLeft || right != oldRight || top != oldTop || bottom != oldBottom) { }
mPiP.update(getActivity(), view);
} private void setVideoView(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);
} }
private void setSubtitleView() { private void setSubtitleView() {
@ -1282,13 +1285,6 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
mPlayers.play(); 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() { public boolean isForeground() {
return foreground; return foreground;
} }
@ -1505,15 +1501,15 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
super.onPictureInPictureModeChanged(isInPictureInPictureMode); super.onPictureInPictureModeChanged(isInPictureInPictureMode);
if (isInPictureInPictureMode) { if (isInPictureInPictureMode) {
PlaybackService.start(mPlayers); PlaybackService.start(mPlayers);
setVideoMargins(0); setVideoView(0);
setSubtitle(10); setSubtitle(10);
hideControl(); hideControl();
hideSheet(); hideSheet();
} else { } else {
setForeground(true); setForeground(true);
PlaybackService.stop(); PlaybackService.stop();
setVideoView(ResUtil.dp2px(16));
setSubtitle(Setting.getSubtitle()); setSubtitle(Setting.getSubtitle());
setVideoMargins(ResUtil.dp2px(16));
if (isStop()) finish(); if (isStop()) finish();
} }
} }

Loading…
Cancel
Save