Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 46 commits into from
May 26, 2025

Conversation

MarcaDian
Copy link
Contributor

@MarcaDian MarcaDian commented May 18, 2025

Introduces a customizable color picker component to settings, allowing users to select interface colors directly within the app with live UI previews.

Part of code adapted from anddea/revanced-patches@bd0aa09


IMG_20250522_142138.jpg

@MarcaDian
Copy link
Contributor Author

MarcaDian commented May 18, 2025

It may also be necessary to rework the color picker call, or perhaps display a toast to the user so that it is obvious that they need to click on the color dot to open the color picker.

I tried to do everything in one dialog box, that is, both the color selection and the edittext, but there are some problems because the fragment extends EditTextPreference.

# Conflicts:
#	extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/objects/SegmentCategoryListPreference.java
@LisoUseInAIKyrios

This comment was marked as resolved.

@LisoUseInAIKyrios
Copy link
Contributor

Is the touch color picker enabled? For the seekbar all I see is a text edit box with the color dot updated as the user types (similar to existing SB color picker).

@MarcaDian
Copy link
Contributor Author

Is the touch color picker enabled? For the seekbar all I see is a text edit box with the color dot updated as the user types (similar to existing SB color picker).

Need to tap on this color dot

@LisoUseInAIKyrios
Copy link
Contributor

If possible, maybe put the color picker in the same dialog as the text edit? One less click.

Or at a minimum, leave the color picker separate like it is now, but add a button to open the color picker.

@MarcaDian

This comment was marked as resolved.

@MarcaDian
Copy link
Contributor Author

MarcaDian commented May 18, 2025

If possible, maybe put the color picker in the same dialog as the text edit?

I wrote about this above.

I tried to do everything in one dialog box, that is, both the color selection and the edittext, but there are some problems because the fragment extends EditTextPreference.

If the problem with saving is resolved, I'll try again.

@LisoUseInAIKyrios
Copy link
Contributor

Problem with saving seems to be fixed.

@MarcaDian
Copy link
Contributor Author

add a button to open the color picker.

How to notify the user about the color selection in the SB? Is it possible to show a toast? There is no place for a button there, but it is not intuitively clear that you need to click on the dot to open the color picker.

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented May 18, 2025

If the color picker can be changed to a single dialog with the touch color and text box, then SB could remove the color string text box and replace it with a button to open the color picker ("change color" button)

@LisoUseInAIKyrios
Copy link
Contributor

Or maybe somehow fit the color picker view into the same edit category dialog?

The color view might need to be resized smaller, but if everything can fit on the category dialog (even if vertical scrolling is required) it would be easier to understand without going into a second dialog.

@MarcaDian

This comment was marked as outdated.

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented May 18, 2025

Functionally that looks a lot better.

Instead of overriding EditTextPreference, maybe override a regular Preference?

If the class extends regular Preference, then add code to handle the Color preference to:


if (pref instanceof ColorPickerPreference colorPref) {
    // todo
}

Edit: since ColorPickerPreference is a shared class, instead just add code to the abstract preference fragment.

@MarcaDian
Copy link
Contributor Author

maybe override a regular Preference?

In the video above I did that.

And here is the result if still use EditTextPreference.
But need to fix the behavior of the buttons.

Screenrecorder-2025-05-18-15-11-03-909.mp4

Need to fix Reset button and left ColorPicker preview
@MarcaDian MarcaDian force-pushed the color-picker-pref branch from 1f971a8 to 5103bd8 Compare May 18, 2025 13:47
@MarcaDian
Copy link
Contributor Author

I still can't initialize the color for the left rectangles, where the top one is the saved color and the bottom one is the current one.

This may be due to UI rendering delays.

@LisoUseInAIKyrios
Copy link
Contributor

Yeah very strange why the preview color areas don't show. The draw rectangle is correct, and the colors are set correctly on the first call to draw().

@LisoUseInAIKyrios
Copy link
Contributor

Manually editing the text color string doesn't update the color preview or the color picker wheel cursor location.

@MarcaDian
Copy link
Contributor Author

MarcaDian commented May 18, 2025

it is updated only when the correct color is entered in the format #FFFFFF, i.e. 6 letters or numbers.

Sometimes looping still occurs when manually entering text.

Perhaps a better solution would be to bring back to 2 dialog and simply add a color picker button.

…ome tweaking or figure out another other way to make the hue selector visible in day mode,
@MarcaDian

This comment was marked as resolved.

@MarcaDian

This comment was marked as resolved.

@MarcaDian
Copy link
Contributor Author

MarcaDian commented May 22, 2025

I think it's ready to merge?

Offtop: My crappy code and professional edits from Liso resulted in a very useful feature for users 😅.

@LisoUseInAIKyrios

This comment was marked as resolved.

@MarcaDian

This comment was marked as resolved.

@LisoUseInAIKyrios

This comment was marked as resolved.

@LisoUseInAIKyrios LisoUseInAIKyrios removed the request for review from oSumAtrIX May 25, 2025 17:43
@LisoUseInAIKyrios
Copy link
Contributor

Yes, seems ready to merge. Will merge tomorrow if there's no new issues by then.

@LisoUseInAIKyrios LisoUseInAIKyrios merged commit 1e0e398 into ReVanced:dev May 26, 2025
1 check passed
@MarcaDian MarcaDian deleted the color-picker-pref branch May 26, 2025 07:23
github-actions bot pushed a commit that referenced this pull request May 26, 2025
# [5.25.0-dev.9](v5.25.0-dev.8...v5.25.0-dev.9) (2025-05-26)

### Features

* **Spotify:** Add `Fix Facebook login` patch ([#5023](#5023)) ([34932dc](34932dc))
* **YouTube - Settings:** Add a color picker ([#4981](#4981)) ([1e0e398](1e0e398))
github-actions bot pushed a commit that referenced this pull request May 26, 2025
# [5.25.0-dev.9](v5.25.0-dev.8...v5.25.0-dev.9) (2025-05-26)

### Features

* **Spotify:** Add `Fix Facebook login` patch ([#5023](#5023)) ([34932dc](34932dc))
* **YouTube - Settings:** Add a color picker ([#4981](#4981)) ([1e0e398](1e0e398))
github-actions bot pushed a commit that referenced this pull request May 26, 2025
# [5.25.0-dev.9](v5.25.0-dev.8...v5.25.0-dev.9) (2025-05-26)

### Features

* **Spotify:** Add `Fix Facebook login` patch ([#5023](#5023)) ([34932dc](34932dc))
* **YouTube - Settings:** Add a color picker ([#4981](#4981)) ([1e0e398](1e0e398))
github-actions bot pushed a commit that referenced this pull request May 26, 2025
# [5.25.0-dev.9](v5.25.0-dev.8...v5.25.0-dev.9) (2025-05-26)

### Features

* **Spotify:** Add `Fix Facebook login` patch ([#5023](#5023)) ([34932dc](34932dc))
* **YouTube - Settings:** Add a color picker ([#4981](#4981)) ([1e0e398](1e0e398))
github-actions bot pushed a commit that referenced this pull request May 26, 2025
# [5.25.0-dev.9](v5.25.0-dev.8...v5.25.0-dev.9) (2025-05-26)

### Features

* **Spotify:** Add `Fix Facebook login` patch ([#5023](#5023)) ([34932dc](34932dc))
* **YouTube - Settings:** Add a color picker ([#4981](#4981)) ([1e0e398](1e0e398))
github-actions bot pushed a commit that referenced this pull request May 29, 2025
# [5.25.0](v5.24.0...v5.25.0) (2025-05-29)

### Bug Fixes

* **Disable Pairip license check:** Change patch to default off ([74b6a94](74b6a94))
* **Hide ADB status:** Resolve app crash on startup ([#5029](#5029)) ([1abebd5](1abebd5))
* **Messenger:** Remove outdated `Disable switching emoji to sticker` patch ([#5044](#5044)) ([7b182ca](7b182ca))
* **Spotify Lite:** Remove obsolete `Enable on demand` patch ([#5046](#5046)) ([4886d47](4886d47))
* **YouTube - GmsCore support:** Restore patch functionality from prior merge ([7686bbe](7686bbe))
* **YouTube - Hide ads:** Hide new type of general ad ([#5004](#5004)) ([37e59d2](37e59d2))
* **YouTube - Open Shorts in regular player:** Do not exit app when pressing back button in regular player ([#5020](#5020)) ([3384f8d](3384f8d))
* **YouTube:** Better handle incorrect duplicate translations ([20abac5](20abac5))
* **Yuka - Unlock premium:** Remove broken patch that is no longer supported ([#5018](#5018)) ([fac6e59](fac6e59))

### Features

* Add `Disable pairip license check` patch ([#4927](#4927)) ([42d2c27](42d2c27))
* **Messenger:** Add `Remove Meta AI` patch ([#4945](#4945)) ([012dff7](012dff7))
* **Prime Video:** Add `Rename shared permissions` patch ([#5049](#5049)) ([80f1fc6](80f1fc6))
* **Spotify:** Add `Fix Facebook login` patch ([#5023](#5023)) ([34932dc](34932dc))
* **Threads:** Hide Ads ([#5064](#5064)) ([3c4cecb](3c4cecb))
* **YouTube - Enable debugging:** Add settings menu to share debug logs ([#5021](#5021)) ([1ec4a88](1ec4a88))
* **YouTube - Settings:** Add a color picker ([#4981](#4981)) ([1e0e398](1e0e398))
* **YouTube - Swipe controls:** Add separate color settings for the brightness and volume bars ([#5043](#5043)) ([80f50e8](80f50e8))
* **YouTube:** Add `Disable haptic feedback` patch ([#5033](#5033)) ([bbe7974](bbe7974))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants