feat(YouTube Music): Add Change header patch
Co-authored-by: ILoveOpenSourceApplications <117499019+iloveopensourceapplications@users.noreply.github.com>
This commit is contained in:
parent
f10f5e2910
commit
f22ea5507d
9 changed files with 351 additions and 192 deletions
|
|
@ -0,0 +1,37 @@
|
|||
package app.revanced.extension.music.patches;
|
||||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.ResourceType;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.music.settings.Settings;
|
||||
|
||||
public class ChangeHeaderPatch {
|
||||
public enum HeaderLogo {
|
||||
DEFAULT(null),
|
||||
REVANCED("revanced_header_dark"),
|
||||
CUSTOM("revanced_header_custom_dark");
|
||||
|
||||
private final String drawableName;
|
||||
|
||||
HeaderLogo(String drawableName) {
|
||||
this.drawableName = drawableName;
|
||||
}
|
||||
|
||||
private Integer getDrawableId() {
|
||||
if (drawableName == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int id = Utils.getResourceIdentifier(ResourceType.DRAWABLE, drawableName);
|
||||
if (id == 0) {
|
||||
Logger.printException(() ->
|
||||
"Header drawable not found: " + drawableName
|
||||
);
|
||||
Settings.HEADER_LOGO.resetToDefault();
|
||||
return null;
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package app.revanced.extension.music.settings;
|
|||
|
||||
import static java.lang.Boolean.FALSE;
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static app.revanced.extension.music.patches.ChangeHeaderPatch.*;
|
||||
import static app.revanced.extension.shared.settings.Setting.parent;
|
||||
|
||||
import app.revanced.extension.shared.settings.YouTubeAndMusicSettings;
|
||||
|
|
@ -28,6 +29,7 @@ public class Settings extends YouTubeAndMusicSettings {
|
|||
public static final BooleanSetting HIDE_NAVIGATION_BAR_UPGRADE_BUTTON = new BooleanSetting("revanced_music_hide_navigation_bar_upgrade_button", TRUE, true);
|
||||
public static final BooleanSetting HIDE_NAVIGATION_BAR = new BooleanSetting("revanced_music_hide_navigation_bar", FALSE, true);
|
||||
public static final BooleanSetting HIDE_NAVIGATION_BAR_LABEL = new BooleanSetting("revanced_music_hide_navigation_bar_labels", FALSE, true);
|
||||
public static final EnumSetting<HeaderLogo> HEADER_LOGO = new EnumSetting<>("revnaced_header_logo", HeaderLogo.DEFAULT, true);
|
||||
|
||||
// Player
|
||||
public static final BooleanSetting CHANGE_MINIPLAYER_COLOR = new BooleanSetting("revanced_music_change_miniplayer_color", FALSE, true);
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ public class YouTubeAndMusicSettings extends BaseSettings {
|
|||
// Miscellaneous
|
||||
public static final BooleanSetting DEBUG_PROTOBUFFER = new BooleanSetting("revanced_debug_protobuffer", FALSE, false,
|
||||
"revanced_debug_protobuffer_user_dialog_message", parent(BaseSettings.DEBUG));
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue