feat(YouTube - Settings): Add a color picker (#4981)

Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
This commit is contained in:
MarcaD
2025-05-26 10:08:45 +03:00
committed by GitHub
parent 34932dc439
commit 1e0e398574
28 changed files with 1199 additions and 130 deletions

View File

@ -48,7 +48,9 @@ private val swipeControlsResourcePatch = resourcePatch {
summaryKey = null,
),
TextPreference("revanced_swipe_overlay_background_opacity", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_overlay_progress_color", inputType = InputType.TEXT_CAP_CHARACTERS),
TextPreference("revanced_swipe_overlay_progress_color",
tag = "app.revanced.extension.shared.settings.preference.ColorPickerPreference",
inputType = InputType.TEXT_CAP_CHARACTERS),
TextPreference("revanced_swipe_text_overlay_size", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_overlay_timeout", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_threshold", inputType = InputType.NUMBER),

View File

@ -89,14 +89,15 @@ val themePatch = bytecodePatch(
execute {
val preferences = mutableSetOf<BasePreference>(
SwitchPreference("revanced_seekbar_custom_color"),
TextPreference("revanced_seekbar_custom_color_primary", inputType = InputType.TEXT_CAP_CHARACTERS),
TextPreference("revanced_seekbar_custom_color_primary",
tag = "app.revanced.extension.shared.settings.preference.ColorPickerPreference",
inputType = InputType.TEXT_CAP_CHARACTERS),
)
if (is_19_25_or_greater) {
preferences += TextPreference(
"revanced_seekbar_custom_color_accent",
inputType = InputType.TEXT_CAP_CHARACTERS
)
preferences += TextPreference("revanced_seekbar_custom_color_accent",
tag = "app.revanced.extension.shared.settings.preference.ColorPickerPreference",
inputType = InputType.TEXT_CAP_CHARACTERS)
}
PreferenceScreen.SEEKBAR.addPreferences(

View File

@ -74,6 +74,7 @@ private val settingsResourcePatch = resourcePatch {
arrayOf(
ResourceGroup("drawable",
"revanced_settings_circle_background.xml",
"revanced_settings_cursor.xml",
"revanced_settings_icon.xml",
"revanced_settings_screen_00_about.xml",
@ -91,6 +92,8 @@ private val settingsResourcePatch = resourcePatch {
"revanced_settings_screen_12_video.xml",
),
ResourceGroup("layout",
"revanced_color_dot_widget.xml",
"revanced_color_picker.xml",
"revanced_preference_with_icon_no_search_result.xml",
"revanced_search_suggestion_item.xml",
"revanced_settings_with_toolbar.xml"),

View File

@ -35,6 +35,8 @@ Second \"item\" text"</string>
<string name="revanced_settings_title" translatable="false">ReVanced</string>
<string name="revanced_settings_confirm_user_dialog_title">Do you wish to proceed?</string>
<string name="revanced_settings_reset">Reset</string>
<string name="revanced_settings_reset_color">Reset color</string>
<string name="revanced_settings_color_invalid">Invalid color</string>
<string name="revanced_settings_restart_title">Refresh and restart</string>
<string name="revanced_settings_restart">Restart</string>
<string name="revanced_settings_import">Import</string>
@ -1161,11 +1163,6 @@ Ready to submit?"</string>
<string name="revanced_sb_stats_saved_second_format">%s seconds</string>
<string name="revanced_sb_color_opacity_label">Opacity:</string>
<string name="revanced_sb_color_dot_label">Color:</string>
<string name="revanced_sb_color_changed">Color changed</string>
<string name="revanced_sb_color_reset">Color reset</string>
<string name="revanced_sb_color_invalid">Invalid color code</string>
<string name="revanced_sb_reset_color">Reset color</string>
<string name="revanced_sb_reset">Reset</string>
<string name="revanced_sb_about_title">About</string>
<string name="revanced_sb_about_api_title" translatable="false">sponsor.ajay.app</string>
<string name="revanced_sb_about_api_summary">Data is provided by the SponsorBlock API. Tap here to learn more and see downloads for other platforms</string>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#FF0000" />
<size
android:width="20dp"
android:height="20dp" />
</shape>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:clipChildren="false"
android:clipToPadding="false">
<View
android:id="@+id/revanced_color_dot_widget"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:background="@drawable/revanced_settings_circle_background"
android:elevation="2dp"
android:translationZ="2dp"
android:outlineProvider="background" />
</FrameLayout>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<app.revanced.extension.shared.settings.preference.ColorPickerView
android:id="@+id/color_picker_view"
android:layout_width="match_parent"
android:layout_height="0dp" />
</LinearLayout>