From 0afdac5683a88a6b4edd1f2fe4be80b3dee6403f Mon Sep 17 00:00:00 2001
From: krlvm <51774833+krlvm@users.noreply.github.com>
Date: Sun, 28 Mar 2021 18:48:51 +0300
Subject: [PATCH] Fix Light Player Popups in Dark Theme, make Player Controls
Overlay always Dark
---
.../org/schabi/newpipe/player/Player.java | 8 +++++--
app/src/main/res/layout-large-land/player.xml | 2 +-
.../main/res/layout/item_stream_segment.xml | 4 ++--
app/src/main/res/layout/player.xml | 2 +-
app/src/main/res/values/attrs.xml | 1 -
app/src/main/res/values/colors.xml | 3 +++
app/src/main/res/values/styles.xml | 13 ----------
app/src/main/res/values/styles_misc.xml | 24 +++++++++++++++++++
8 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java
index 53d9a3ef0..487c93336 100644
--- a/app/src/main/java/org/schabi/newpipe/player/Player.java
+++ b/app/src/main/java/org/schabi/newpipe/player/Player.java
@@ -26,6 +26,7 @@ import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
+import android.view.ContextThemeWrapper;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -446,9 +447,12 @@ public final class Player implements
binding.playbackSeekBar.getProgressDrawable()
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY));
- qualityPopupMenu = new PopupMenu(context, binding.qualityTextView);
+ final ContextThemeWrapper themeWrapper = new ContextThemeWrapper(getContext(),
+ R.style.DarkPopupMenu);
+
+ qualityPopupMenu = new PopupMenu(themeWrapper, binding.qualityTextView);
playbackSpeedPopupMenu = new PopupMenu(context, binding.playbackSpeed);
- captionPopupMenu = new PopupMenu(context, binding.captionTextView);
+ captionPopupMenu = new PopupMenu(themeWrapper, binding.captionTextView);
binding.progressBarLoadingPanel.getIndeterminateDrawable()
.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY));
diff --git a/app/src/main/res/layout-large-land/player.xml b/app/src/main/res/layout-large-land/player.xml
index cbb162407..ddb80d56a 100644
--- a/app/src/main/res/layout-large-land/player.xml
+++ b/app/src/main/res/layout-large-land/player.xml
@@ -474,7 +474,7 @@
android:layout_width="380dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
- android:background="?attr/queue_background_color"
+ android:background="@color/queue_background_color"
android:visibility="gone"
tools:visibility="visible">
diff --git a/app/src/main/res/layout/item_stream_segment.xml b/app/src/main/res/layout/item_stream_segment.xml
index 7ae66bc70..9f3ea1d0e 100644
--- a/app/src/main/res/layout/item_stream_segment.xml
+++ b/app/src/main/res/layout/item_stream_segment.xml
@@ -42,7 +42,7 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
- android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textAppearance="@style/ItemStreamSegmentTitle"
android:textSize="@dimen/video_item_search_title_text_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -53,7 +53,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textAppearance="@style/ItemStreamSegmentSubtitle"
android:textSize="@dimen/video_item_search_upload_date_text_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTitle"
diff --git a/app/src/main/res/layout/player.xml b/app/src/main/res/layout/player.xml
index be6b09103..7e9a0bad2 100644
--- a/app/src/main/res/layout/player.xml
+++ b/app/src/main/res/layout/player.xml
@@ -471,7 +471,7 @@
android:id="@+id/itemsListPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="?attr/queue_background_color"
+ android:background="@color/queue_background_color"
android:visibility="gone"
tools:visibility="visible">
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index 65a11cc09..43fcb2db0 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -12,7 +12,6 @@
-
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 2b86c2955..1a1b3a9bb 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -48,6 +48,7 @@
#25FFFFFF
+ @color/dark_queue_background_color
#F2FFFFFF
#aa000000
#c8E53935
@@ -80,6 +81,8 @@
#FFFFFF
+ #C9CACB
+
#EFEFEF
#E0E0E0
#616161
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index f1eb2688e..ce56d5a30 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -32,7 +32,6 @@
- @color/light_contrast_background_color
- @drawable/selector_checked_light
- @drawable/selector_focused_light
- - @color/light_queue_background_color
- @drawable/toolbar_shadow_light
- @drawable/selector_light
- @color/light_ripple_color
@@ -60,7 +59,6 @@
- @color/dark_contrast_background_color
- @drawable/selector_checked_dark
- @drawable/selector_focused_dark
- - @color/dark_queue_background_color
- @drawable/toolbar_shadow_dark
- @drawable/selector_dark
- @color/dark_ripple_color
@@ -187,15 +185,4 @@
- @color/white
-
-
-
-
-
diff --git a/app/src/main/res/values/styles_misc.xml b/app/src/main/res/values/styles_misc.xml
index c88fca7f9..cad7ce904 100644
--- a/app/src/main/res/values/styles_misc.xml
+++ b/app/src/main/res/values/styles_misc.xml
@@ -41,4 +41,28 @@
- @color/dark_youtube_dark_color
- @color/dark_settings_accent_color
+
+
+
+
+
+
+
+
+
+
+
+