diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 1d83094dc..6c459ffe9 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -2158,8 +2158,9 @@ public class VideoDetailFragment /** * That's for Android TV support. Move focus from main fragment to the player or back * based on what is currently selected + * * @param toMain if true than the main fragment will be focused or the player otherwise - * */ + */ private void moveFocusToMainFragment(final boolean toMain) { final ViewGroup mainFragment = requireActivity().findViewById(R.id.fragment_holder); // Hamburger button steels a focus even under bottomSheet diff --git a/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java index 53296d915..703be346e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java @@ -163,6 +163,9 @@ public final class MainPlayer extends Service { // from one stream to a new stream not smooth playerImpl.getPlayer().stop(false); playerImpl.setRecovery(); + // Android TV will handle back button in case controls will be visible + // (one more additional unneeded click while the player is hidden) + playerImpl.hideControls(0, 0); // Notification shows information about old stream but if a user selects // a stream from backStack it's not actual anymore // So we should hide the notification at all. diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java index 8a4f7fdc5..d2eb591f4 100644 --- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java +++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java @@ -253,9 +253,12 @@ public class VideoPlayerImpl extends VideoPlayer getRootView().setVisibility(View.VISIBLE); initPopup(); initPopupCloseOverlay(); + playPauseButton.requestFocus(); } else { getRootView().setVisibility(View.VISIBLE); initVideoPlayer(); + // Android TV: without it focus will frame the whole player + playPauseButton.requestFocus(); } onPlay(); @@ -1057,10 +1060,10 @@ public class VideoPlayerImpl extends VideoPlayer private void animatePlayButtons(final boolean show, final int duration) { animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, show, duration); - if (playQueue.getIndex() > 0) { + if (playQueue.getIndex() > 0 || !show) { animateView(playPreviousButton, AnimationUtils.Type.SCALE_AND_ALPHA, show, duration); } - if (playQueue.getIndex() + 1 < playQueue.getStreams().size()) { + if (playQueue.getIndex() + 1 < playQueue.getStreams().size() || !show) { animateView(playNextButton, AnimationUtils.Type.SCALE_AND_ALPHA, show, duration); } diff --git a/app/src/main/res/layout-large-land/fragment_video_detail.xml b/app/src/main/res/layout-large-land/fragment_video_detail.xml index 95d2f3c00..f69832b81 100644 --- a/app/src/main/res/layout-large-land/fragment_video_detail.xml +++ b/app/src/main/res/layout-large-land/fragment_video_detail.xml @@ -153,12 +153,12 @@ tools:visibility="visible" /> - +