mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-14 21:00:17 +01:00
Another part of UI improvements for Android TV
- focus will be hidden right after start of a video; fullscreen works like this too - back button will not needed to be pressed one more time like before - prev & next buttons for playqueue will be hidden with play/pause button before video be ready to play
This commit is contained in:
parent
ec8b00042b
commit
f2e4b69466
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -153,12 +153,12 @@
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!-- Player will be inserted here in realtime -->
|
||||
<FrameLayout
|
||||
android:id="@+id/player_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
/>
|
||||
<FrameLayout
|
||||
android:id="@+id/player_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user