From c0e1bbbfb683811cfa90f0e2ee33f459ca3eb2d1 Mon Sep 17 00:00:00 2001 From: Stypox Date: Fri, 2 Oct 2020 11:16:10 +0200 Subject: [PATCH 1/5] Fix queue close image not following theme --- app/src/main/res/layout-large-land/player.xml | 2 +- app/src/main/res/layout/player.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout-large-land/player.xml b/app/src/main/res/layout-large-land/player.xml index 7e27765a0..8191d245b 100644 --- a/app/src/main/res/layout-large-land/player.xml +++ b/app/src/main/res/layout-large-land/player.xml @@ -483,7 +483,7 @@ android:focusable="true" android:padding="10dp" android:scaleType="fitXY" - app:srcCompat="@drawable/ic_close_white_24dp" /> + app:srcCompat="?attr/ic_close" /> + app:srcCompat="?attr/ic_close" /> Date: Fri, 2 Oct 2020 14:24:18 +0200 Subject: [PATCH 2/5] Prevent touches behind minimized player --- .../main/res/layout-large-land/fragment_video_detail.xml | 9 ++++----- app/src/main/res/layout/fragment_video_detail.xml | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) 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 e2d18434d..9c0f03cb3 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 @@ -600,16 +600,16 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:alpha="0.9" - android:paddingLeft="@dimen/video_item_search_padding" - android:paddingRight="@dimen/video_item_search_padding" android:descendantFocusability="blocksDescendants" android:background="?attr/windowBackground" > diff --git a/app/src/main/res/layout/fragment_video_detail.xml b/app/src/main/res/layout/fragment_video_detail.xml index e6c78585e..bf4f59a8c 100644 --- a/app/src/main/res/layout/fragment_video_detail.xml +++ b/app/src/main/res/layout/fragment_video_detail.xml @@ -574,11 +574,12 @@ android:background="?attr/windowBackground" > Date: Fri, 2 Oct 2020 14:28:14 +0200 Subject: [PATCH 3/5] Make player close button always white --- app/src/main/res/layout-large-land/player.xml | 2 +- app/src/main/res/layout/player.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout-large-land/player.xml b/app/src/main/res/layout-large-land/player.xml index 8191d245b..77d2a5321 100644 --- a/app/src/main/res/layout-large-land/player.xml +++ b/app/src/main/res/layout-large-land/player.xml @@ -101,7 +101,7 @@ android:clickable="true" android:focusable="true" android:scaleType="fitXY" - app:srcCompat="?attr/ic_close" + app:srcCompat="@drawable/ic_close_white_24dp" android:background="?attr/selectableItemBackgroundBorderless" tools:ignore="ContentDescription,RtlHardcoded" android:visibility="gone" /> diff --git a/app/src/main/res/layout/player.xml b/app/src/main/res/layout/player.xml index 96b1c682d..486a0bd2d 100644 --- a/app/src/main/res/layout/player.xml +++ b/app/src/main/res/layout/player.xml @@ -99,7 +99,7 @@ android:clickable="true" android:focusable="true" android:scaleType="fitXY" - app:srcCompat="?attr/ic_close" + app:srcCompat="@drawable/ic_close_white_24dp" android:background="?attr/selectableItemBackgroundBorderless" tools:ignore="ContentDescription,RtlHardcoded" android:visibility="gone" /> From fbcdaa77e317ffcdaf57ec7bf2248751127d5b67 Mon Sep 17 00:00:00 2001 From: Stypox Date: Fri, 2 Oct 2020 15:17:04 +0200 Subject: [PATCH 4/5] Initialize player notification asap Otherwise Android's foreground services implementation would complain --- app/src/main/java/org/schabi/newpipe/player/MainPlayer.java | 2 ++ 1 file changed, 2 insertions(+) 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 0aed3469f..c7fbb444b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java @@ -103,6 +103,8 @@ public final class MainPlayer extends Service { playerImpl = new VideoPlayerImpl(this); playerImpl.setup(layout); playerImpl.shouldUpdateOnProgress = true; + + NotificationUtil.getInstance().createNotificationAndStartForeground(playerImpl, this); } @Override From dbb86d25e177c7cd02764d1aa20844830ade4bc3 Mon Sep 17 00:00:00 2001 From: Stypox Date: Fri, 2 Oct 2020 16:03:43 +0200 Subject: [PATCH 5/5] Fix video detail controls visibility set inconsistently --- .../fragments/detail/VideoDetailFragment.java | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) 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 cf993ccbb..28a67173b 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 @@ -1550,22 +1550,16 @@ public class VideoDetailFragment 0); } - switch (info.getStreamType()) { - case LIVE_STREAM: - case AUDIO_LIVE_STREAM: - detailControlsDownload.setVisibility(View.GONE); - break; - default: - if (info.getAudioStreams().isEmpty()) { - detailControlsBackground.setVisibility(View.GONE); - } - if (!info.getVideoStreams().isEmpty() || !info.getVideoOnlyStreams().isEmpty()) { - break; - } - detailControlsPopup.setVisibility(View.GONE); - thumbnailPlayButton.setImageResource(R.drawable.ic_headset_shadow); - break; - } + detailControlsDownload.setVisibility(info.getStreamType() == StreamType.LIVE_STREAM + || info.getStreamType() == StreamType.AUDIO_LIVE_STREAM ? View.GONE : View.VISIBLE); + detailControlsBackground.setVisibility(info.getAudioStreams().isEmpty() + ? View.GONE : View.VISIBLE); + + final boolean noVideoStreams = + info.getVideoStreams().isEmpty() && info.getVideoOnlyStreams().isEmpty(); + detailControlsPopup.setVisibility(noVideoStreams ? View.GONE : View.VISIBLE); + thumbnailPlayButton.setImageResource( + noVideoStreams ? R.drawable.ic_headset_shadow : R.drawable.ic_play_arrow_shadow); } private void hideAgeRestrictedContent() {