Skip to content
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

feat: Add Change icon patch #4020

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft

feat: Add Change icon patch #4020

wants to merge 3 commits into from

Conversation

oSumAtrIX
Copy link
Member

@oSumAtrIX oSumAtrIX commented Nov 29, 2024

About

This patch is meant to replace the current branding patch for YouTube but also enable patching any apps icon.

Details

The idea is to ask the user for adaptive icons by default, and a fallback full icon. As it turns out there's like 10 ways to create an icon on Android. How the patch works is, it reads the manifest which references the icon. The reference can be a png file, an XML file, a drawable, mipmap and more. In the case of it being a mipmap and the reference pointing to an adaptive icon, the patch can be applied as it currently is on YouTube. In the other cases, the icon is replaced with fullIcon.

The patch isn't done yet, and there's probably a couple considerations that haven't been made yet, but that'll be clear during the implementation. For example fullIcon is currently just one icon, but IIRC there can be a drawable icon for each density for example, so scenarios like this need to be covered by the patch.

Now the user just has to provide a couple of icons for every pixel density and the patch will overwrite the usages accordingly. Much simpler approach

Todo

  • Finish implementation (Deprecate old custom branding patch, create a change name patch, add proper default monochrome icon and regular square icon, and round icon with border)
  • Test

@oSumAtrIX oSumAtrIX marked this pull request as draft November 29, 2024 02:23
# Conflicts:
#	patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/Fingerprints.kt
@oSumAtrIX
Copy link
Member Author

oSumAtrIX commented Dec 5, 2024

So there are two questions. Right now, users have to provide icons for all densities. This is a bit annoying. Technically, a single icon can be provided, which Android the scales. However, due to the scaling, these tiny artifacts (such as aliasing) could look weird.
Additionally, the ability to provide adaptive icons is provided. Without those, Android can't use the FG or BG accordingly, such as for a splash screen. So, 3 icons for each density (monochrome exists, too). https://icon.kitchen/ is linked to the options, but it is still tedious.

@LisoUseInAIKyrios, any suggestions? The user could simply provide a vector image, then we wouldn't need to account for all densities.

@LisoUseInAIKyrios
Copy link
Contributor

Requiring vector image would fix the multiple resolution issue, but obviously is limited to what images can be used.

How popular is using custom images? Since most launchers support changing the icon, it would seem the most common use case is to apply the ReVanced icon to a given app (and not apply an arbitrary icon). So if it's a hassle to resize a custom icon then it may not matter if users don't use it often.

Dynamically resizing an image is possible but would require kotlin multiplatform or pulling in a third party image library since the JRE and Android have completely different image libraries.

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