fix pause of playback in split-screen mode

This commit is contained in:
Felix 2017-12-27 13:57:53 +01:00
parent e9222a5fdd
commit 93aa123769

View file

@ -108,8 +108,22 @@ public class ExoPlayerFragment extends Fragment implements PlayerEventListener.P
}
@Override
public void onResume() {
super.onResume();
public void onStop() {
super.onStop();
if (exoPlayer != null) {
viewModel.setPlaybackProgress(item.getEventId(), exoPlayer.getCurrentPosition());
exoPlayer.setPlayWhenReady(false);
}
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
@Override
public void onStart() {
super.onStart();
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
if (exoPlayer != null) {
exoPlayer.setPlayWhenReady(playbackState);
viewModel.getPlaybackProgress(item.getEventId()).observe(this, playbackProgress -> {
@ -121,29 +135,6 @@ public class ExoPlayerFragment extends Fragment implements PlayerEventListener.P
}
}
@Override
public void onStop() {
super.onStop();
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
@Override
public void onPause() {
super.onPause();
if (exoPlayer != null) {
viewModel.setPlaybackProgress(item.getEventId(), exoPlayer.getCurrentPosition());
exoPlayer.setPlayWhenReady(false);
}
}
@Override
public void onStart() {
super.onStart();
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);