From 22bb129bd926ae8716c737fb95772642fdb21a55 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Thu, 9 Jan 2020 18:28:06 +0300 Subject: [PATCH] Autoplay enhancement and new button at the top left corner - added a video close button to the top left corner - autoplay will not work if stream plays in background or popup players --- app/src/main/AndroidManifest.xml | 4 +- .../fragments/detail/VideoDetailFragment.java | 37 +++++++++++++------ .../newpipe/player/VideoPlayerImpl.java | 9 +++++ .../activity_main_player.xml | 14 +++++++ .../main/res/layout/activity_main_player.xml | 14 +++++++ 5 files changed, 65 insertions(+), 13 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0f8339f81..18e424524 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -38,9 +38,9 @@ - + { if (l != ol || t != ot || r != or || b != ob) { @@ -555,9 +560,11 @@ public class VideoPlayerImpl extends VideoPlayer if (!isInFullscreen()) { titleTextView.setVisibility(View.GONE); channelTextView.setVisibility(View.GONE); + playerCloseButton.setVisibility(videoPlayerSelected() ? View.VISIBLE : View.GONE); } else { titleTextView.setVisibility(View.VISIBLE); channelTextView.setVisibility(View.VISIBLE); + playerCloseButton.setVisibility(View.GONE); } } @@ -597,6 +604,8 @@ public class VideoPlayerImpl extends VideoPlayer } else if (v.getId() == fullscreenButton.getId()) { toggleFullscreen(); + } else if (v.getId() == playerCloseButton.getId()) { + service.sendBroadcast(new Intent(VideoDetailFragment.ACTION_HIDE_MAIN_PLAYER)); } if (getCurrentState() != STATE_COMPLETED) { diff --git a/app/src/main/res/layout-large-land/activity_main_player.xml b/app/src/main/res/layout-large-land/activity_main_player.xml index 7fb1872cf..df0ada0b0 100644 --- a/app/src/main/res/layout-large-land/activity_main_player.xml +++ b/app/src/main/res/layout-large-land/activity_main_player.xml @@ -175,6 +175,20 @@ android:paddingLeft="2dp" tools:ignore="RtlHardcoded"> + + + +