mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-30 06:34:37 +02:00
feat(YouTube Music - Hide action bar components): Add Change action bar position
setting (YouTube Music 7.25.53+)
This commit is contained in:
parent
9adcdbfbc7
commit
a23944945f
@ -19,6 +19,8 @@ import app.revanced.extension.shared.utils.PackageUtils;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class ActionBarPatch {
|
public class ActionBarPatch {
|
||||||
|
private static final boolean CHANGE_ACTION_BAR_POSITION =
|
||||||
|
Settings.CHANGE_ACTION_BAR_POSITION.get();
|
||||||
private static final boolean HIDE_ACTION_BUTTON_LABEL =
|
private static final boolean HIDE_ACTION_BUTTON_LABEL =
|
||||||
Settings.HIDE_ACTION_BUTTON_LABEL.get();
|
Settings.HIDE_ACTION_BUTTON_LABEL.get();
|
||||||
private static final boolean HIDE_ACTION_BUTTON_LIKE_DISLIKE =
|
private static final boolean HIDE_ACTION_BUTTON_LIKE_DISLIKE =
|
||||||
@ -36,6 +38,12 @@ public class ActionBarPatch {
|
|||||||
@NonNull
|
@NonNull
|
||||||
private static String buttonType = "";
|
private static String buttonType = "";
|
||||||
|
|
||||||
|
public static boolean changeActionBarPosition(boolean original) {
|
||||||
|
return SETTINGS_INITIALIZED
|
||||||
|
? CHANGE_ACTION_BAR_POSITION
|
||||||
|
: original;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hideActionBarLabel() {
|
public static boolean hideActionBarLabel() {
|
||||||
return HIDE_ACTION_BUTTON_LABEL;
|
return HIDE_ACTION_BUTTON_LABEL;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ public class Settings extends BaseSettings {
|
|||||||
|
|
||||||
|
|
||||||
// PreferenceScreen: Action Bar
|
// PreferenceScreen: Action Bar
|
||||||
|
public static final BooleanSetting CHANGE_ACTION_BAR_POSITION = new BooleanSetting("revanced_change_action_bar_position", FALSE, true);
|
||||||
public static final BooleanSetting HIDE_ACTION_BUTTON_LIKE_DISLIKE = new BooleanSetting("revanced_hide_action_button_like_dislike", FALSE, true);
|
public static final BooleanSetting HIDE_ACTION_BUTTON_LIKE_DISLIKE = new BooleanSetting("revanced_hide_action_button_like_dislike", FALSE, true);
|
||||||
public static final BooleanSetting HIDE_ACTION_BUTTON_COMMENT = new BooleanSetting("revanced_hide_action_button_comment", FALSE, true);
|
public static final BooleanSetting HIDE_ACTION_BUTTON_COMMENT = new BooleanSetting("revanced_hide_action_button_comment", FALSE, true);
|
||||||
public static final BooleanSetting HIDE_ACTION_BUTTON_ADD_TO_PLAYLIST = new BooleanSetting("revanced_hide_action_button_add_to_playlist", FALSE, true);
|
public static final BooleanSetting HIDE_ACTION_BUTTON_ADD_TO_PLAYLIST = new BooleanSetting("revanced_hide_action_button_add_to_playlist", FALSE, true);
|
||||||
|
@ -25,6 +25,7 @@ import app.revanced.patches.shared.litho.addLithoFilter
|
|||||||
import app.revanced.patches.shared.litho.lithoFilterPatch
|
import app.revanced.patches.shared.litho.lithoFilterPatch
|
||||||
import app.revanced.patches.shared.textcomponent.hookSpannableString
|
import app.revanced.patches.shared.textcomponent.hookSpannableString
|
||||||
import app.revanced.patches.shared.textcomponent.textComponentPatch
|
import app.revanced.patches.shared.textcomponent.textComponentPatch
|
||||||
|
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
|
||||||
import app.revanced.util.fingerprint.matchOrThrow
|
import app.revanced.util.fingerprint.matchOrThrow
|
||||||
import app.revanced.util.fingerprint.methodOrThrow
|
import app.revanced.util.fingerprint.methodOrThrow
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
@ -77,6 +78,19 @@ val actionBarComponentsPatch = bytecodePatch(
|
|||||||
nop
|
nop
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (is_7_25_or_greater) {
|
||||||
|
actionBarPositionFeatureFlagFingerprint.injectLiteralInstructionBooleanCall(
|
||||||
|
ACTION_BAR_POSITION_FEATURE_FLAG,
|
||||||
|
"$ACTIONBAR_CLASS_DESCRIPTOR->changeActionBarPosition(Z)Z"
|
||||||
|
)
|
||||||
|
|
||||||
|
addSwitchPreference(
|
||||||
|
CategoryType.ACTION_BAR,
|
||||||
|
"revanced_change_action_bar_position",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_7_25_or_greater) {
|
if (!is_7_25_or_greater) {
|
||||||
|
@ -22,6 +22,15 @@ internal val actionBarComponentFingerprint = legacyFingerprint(
|
|||||||
literals = listOf(99180L),
|
literals = listOf(99180L),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
internal const val ACTION_BAR_POSITION_FEATURE_FLAG = 45658717L
|
||||||
|
|
||||||
|
internal val actionBarPositionFeatureFlagFingerprint = legacyFingerprint(
|
||||||
|
name = "actionBarPositionFeatureFlagFingerprint",
|
||||||
|
returnType = "Z",
|
||||||
|
parameters = emptyList(),
|
||||||
|
literals = listOf(ACTION_BAR_POSITION_FEATURE_FLAG)
|
||||||
|
)
|
||||||
|
|
||||||
internal val likeDislikeContainerFingerprint = legacyFingerprint(
|
internal val likeDislikeContainerFingerprint = legacyFingerprint(
|
||||||
name = "likeDislikeContainerFingerprint",
|
name = "likeDislikeContainerFingerprint",
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
<!-- PreferenceScreen: Action bar -->
|
<!-- PreferenceScreen: Action bar -->
|
||||||
<string name="revanced_preference_screen_action_bar_title">Action bar</string>
|
<string name="revanced_preference_screen_action_bar_title">Action bar</string>
|
||||||
|
|
||||||
|
<string name="revanced_change_action_bar_position_title">Change action bar position</string>
|
||||||
|
<string name="revanced_change_action_bar_position_summary">Moves the action bar below the play button.</string>
|
||||||
<string name="revanced_hide_action_button_like_dislike_title">Hide Like and Dislike buttons</string>
|
<string name="revanced_hide_action_button_like_dislike_title">Hide Like and Dislike buttons</string>
|
||||||
<string name="revanced_hide_action_button_like_dislike_summary">Hides the Like and Dislike buttons. It does not work in the old player layout.</string>
|
<string name="revanced_hide_action_button_like_dislike_summary">Hides the Like and Dislike buttons. It does not work in the old player layout.</string>
|
||||||
<string name="revanced_hide_action_button_comment_title">Hide Comments button</string>
|
<string name="revanced_hide_action_button_comment_title">Hide Comments button</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user