remove duplicated code for toggle Fullscreen
This commit is contained in:
parent
22a4a4b2df
commit
e30a552b6c
|
@ -1059,6 +1059,14 @@ public final class VideoDetailFragment
|
||||||
// Play Utils
|
// Play Utils
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
|
private void toggleFullscreenIfInFullscreenMode() {
|
||||||
|
// If a user watched video inside fullscreen mode and than chose another player
|
||||||
|
// return to non-fullscreen mode
|
||||||
|
if (isPlayerAvailable() && player.isFullscreen()) {
|
||||||
|
player.toggleFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void openBackgroundPlayer(final boolean append) {
|
private void openBackgroundPlayer(final boolean append) {
|
||||||
final AudioStream audioStream = currentInfo.getAudioStreams()
|
final AudioStream audioStream = currentInfo.getAudioStreams()
|
||||||
.get(ListHelper.getDefaultAudioFormat(activity, currentInfo.getAudioStreams()));
|
.get(ListHelper.getDefaultAudioFormat(activity, currentInfo.getAudioStreams()));
|
||||||
|
@ -1067,11 +1075,7 @@ public final class VideoDetailFragment
|
||||||
.getDefaultSharedPreferences(activity)
|
.getDefaultSharedPreferences(activity)
|
||||||
.getBoolean(activity.getString(R.string.use_external_audio_player_key), false);
|
.getBoolean(activity.getString(R.string.use_external_audio_player_key), false);
|
||||||
|
|
||||||
// If a user watched video inside fullscreen mode and than chose another player
|
toggleFullscreenIfInFullscreenMode();
|
||||||
// return to non-fullscreen mode
|
|
||||||
if (isPlayerAvailable() && player.isFullscreen()) {
|
|
||||||
player.toggleFullscreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!useExternalAudioPlayer) {
|
if (!useExternalAudioPlayer) {
|
||||||
openNormalBackgroundPlayer(append);
|
openNormalBackgroundPlayer(append);
|
||||||
|
@ -1091,11 +1095,7 @@ public final class VideoDetailFragment
|
||||||
PlayerHolder.startService(App.getApp(), false, this);
|
PlayerHolder.startService(App.getApp(), false, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a user watched video inside fullscreen mode and than chose another player
|
toggleFullscreenIfInFullscreenMode();
|
||||||
// return to non-fullscreen mode
|
|
||||||
if (isPlayerAvailable() && player.isFullscreen()) {
|
|
||||||
player.toggleFullscreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
final PlayQueue queue = setupPlayQueueForIntent(append);
|
final PlayQueue queue = setupPlayQueueForIntent(append);
|
||||||
if (append) {
|
if (append) {
|
||||||
|
@ -1393,9 +1393,8 @@ public final class VideoDetailFragment
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPlayerAvailable() && player.isFullscreen()) {
|
toggleFullscreenIfInFullscreenMode();
|
||||||
player.toggleFullscreen();
|
|
||||||
}
|
|
||||||
// This will show systemUI and pause the player.
|
// This will show systemUI and pause the player.
|
||||||
// User can tap on Play button and video will be in fullscreen mode again
|
// User can tap on Play button and video will be in fullscreen mode again
|
||||||
// Note for tablet: trying to avoid orientation changes since it's not easy
|
// Note for tablet: trying to avoid orientation changes since it's not easy
|
||||||
|
@ -1812,9 +1811,7 @@ public final class VideoDetailFragment
|
||||||
if (error.type == ExoPlaybackException.TYPE_SOURCE
|
if (error.type == ExoPlaybackException.TYPE_SOURCE
|
||||||
|| error.type == ExoPlaybackException.TYPE_UNEXPECTED) {
|
|| error.type == ExoPlaybackException.TYPE_UNEXPECTED) {
|
||||||
// Properly exit from fullscreen
|
// Properly exit from fullscreen
|
||||||
if (isPlayerAndPlayerServiceAvailable() && player.isFullscreen()) {
|
toggleFullscreenIfInFullscreenMode();
|
||||||
player.toggleFullscreen();
|
|
||||||
}
|
|
||||||
hideMainPlayer();
|
hideMainPlayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue