Fix Light Player Popups in Dark Theme, make Player Controls Overlay always Dark

This commit is contained in:
krlvm 2021-03-28 18:48:51 +03:00
parent 609d09a8e2
commit 0afdac5683
No known key found for this signature in database
GPG Key ID: B8552A91FD265536
8 changed files with 37 additions and 20 deletions

View File

@ -26,6 +26,7 @@ import android.provider.Settings;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -446,9 +447,12 @@ public final class Player implements
binding.playbackSeekBar.getProgressDrawable() binding.playbackSeekBar.getProgressDrawable()
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY)); .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); playbackSpeedPopupMenu = new PopupMenu(context, binding.playbackSpeed);
captionPopupMenu = new PopupMenu(context, binding.captionTextView); captionPopupMenu = new PopupMenu(themeWrapper, binding.captionTextView);
binding.progressBarLoadingPanel.getIndeterminateDrawable() binding.progressBarLoadingPanel.getIndeterminateDrawable()
.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY)); .setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY));

View File

@ -474,7 +474,7 @@
android:layout_width="380dp" android:layout_width="380dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:background="?attr/queue_background_color" android:background="@color/queue_background_color"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">

View File

@ -42,7 +42,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="@style/ItemStreamSegmentTitle"
android:textSize="@dimen/video_item_search_title_text_size" android:textSize="@dimen/video_item_search_title_text_size"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@ -53,7 +53,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="@style/ItemStreamSegmentSubtitle"
android:textSize="@dimen/video_item_search_upload_date_text_size" android:textSize="@dimen/video_item_search_upload_date_text_size"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTitle" app:layout_constraintTop_toBottomOf="@id/textViewTitle"

View File

@ -471,7 +471,7 @@
android:id="@+id/itemsListPanel" android:id="@+id/itemsListPanel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/queue_background_color" android:background="@color/queue_background_color"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">

View File

@ -12,7 +12,6 @@
<attr name="dashed_border" format="reference" /> <attr name="dashed_border" format="reference" />
<attr name="separator_color" format="color" /> <attr name="separator_color" format="color" />
<attr name="queue_background_color" format="color" />
<attr name="contrast_background_color" format="color" /> <attr name="contrast_background_color" format="color" />
<attr name="windowBackground" format="color" /> <attr name="windowBackground" format="color" />
<attr name="colorPrimary" format="color" /> <attr name="colorPrimary" format="color" />

View File

@ -48,6 +48,7 @@
<color name="black_border_color">#25FFFFFF</color> <color name="black_border_color">#25FFFFFF</color>
<!-- Miscellaneous --> <!-- Miscellaneous -->
<color name="queue_background_color">@color/dark_queue_background_color</color>
<color name="drawer_header_font_color">#F2FFFFFF</color> <color name="drawer_header_font_color">#F2FFFFFF</color>
<color name="duration_background_color">#aa000000</color> <color name="duration_background_color">#aa000000</color>
<color name="live_duration_background_color">#c8E53935</color> <color name="live_duration_background_color">#c8E53935</color>
@ -80,6 +81,8 @@
<!-- GigaGet Component colors --> <!-- GigaGet Component colors -->
<color name="white">#FFFFFF</color> <color name="white">#FFFFFF</color>
<color name="white_secondary">#C9CACB</color>
<color name="light_gray">#EFEFEF</color> <color name="light_gray">#EFEFEF</color>
<color name="middle_gray">#E0E0E0</color> <color name="middle_gray">#E0E0E0</color>
<color name="gray">#616161</color> <color name="gray">#616161</color>

View File

@ -32,7 +32,6 @@
<item name="contrast_background_color">@color/light_contrast_background_color</item> <item name="contrast_background_color">@color/light_contrast_background_color</item>
<item name="checked_selector">@drawable/selector_checked_light</item> <item name="checked_selector">@drawable/selector_checked_light</item>
<item name="focused_selector">@drawable/selector_focused_light</item> <item name="focused_selector">@drawable/selector_focused_light</item>
<item name="queue_background_color">@color/light_queue_background_color</item>
<item name="toolbar_shadow">@drawable/toolbar_shadow_light</item> <item name="toolbar_shadow">@drawable/toolbar_shadow_light</item>
<item name="selector">@drawable/selector_light</item> <item name="selector">@drawable/selector_light</item>
<item name="colorControlHighlight">@color/light_ripple_color</item> <item name="colorControlHighlight">@color/light_ripple_color</item>
@ -60,7 +59,6 @@
<item name="contrast_background_color">@color/dark_contrast_background_color</item> <item name="contrast_background_color">@color/dark_contrast_background_color</item>
<item name="checked_selector">@drawable/selector_checked_dark</item> <item name="checked_selector">@drawable/selector_checked_dark</item>
<item name="focused_selector">@drawable/selector_focused_dark</item> <item name="focused_selector">@drawable/selector_focused_dark</item>
<item name="queue_background_color">@color/dark_queue_background_color</item>
<item name="toolbar_shadow">@drawable/toolbar_shadow_dark</item> <item name="toolbar_shadow">@drawable/toolbar_shadow_dark</item>
<item name="selector">@drawable/selector_dark</item> <item name="selector">@drawable/selector_dark</item>
<item name="colorControlHighlight">@color/dark_ripple_color</item> <item name="colorControlHighlight">@color/dark_ripple_color</item>
@ -187,15 +185,4 @@
<item name="iconTint">@color/white</item> <item name="iconTint">@color/white</item>
</style> </style>
<style name="WhiteAccentTheme">
<item name="colorAccent">@color/white</item>
</style>
<style name="WhiteTintTheme">
<item name="tint">@color/white</item>
</style>
<style name="ContrastTintTheme">
<item name="tint">@color/contrastColor</item>
</style>
</resources> </resources>

View File

@ -41,4 +41,28 @@
<item name="colorPrimaryDark">@color/dark_youtube_dark_color</item> <item name="colorPrimaryDark">@color/dark_youtube_dark_color</item>
<item name="colorAccent">@color/dark_settings_accent_color</item> <item name="colorAccent">@color/dark_settings_accent_color</item>
</style> </style>
<style name="ItemStreamSegmentTitle" parent="TextAppearance.AppCompat.Large">
<item name="android:textColor">@color/white</item>
</style>
<style name="ItemStreamSegmentSubtitle" parent="TextAppearance.AppCompat.Small">
<item name="android:textColor">@color/white_secondary</item>
</style>
<style name="DarkPopupMenu" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="WhiteAccentTheme">
<item name="colorAccent">@color/white</item>
</style>
<style name="WhiteTintTheme">
<item name="tint">@color/white</item>
</style>
<style name="DarkTintTheme">
<item name="tint">@color/black</item>
</style>
<style name="ContrastTintTheme">
<item name="tint">@color/contrastColor</item>
</style>
</resources> </resources>