mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-09 11:04:36 +02:00
feat(YouTube/Hide feed components): add Hide floating button
setting
This commit is contained in:
parent
dc379e5a0f
commit
e644186dbf
@ -19,10 +19,10 @@ abstract class BaseMainActivityResolvePatch(
|
||||
) {
|
||||
lateinit var mainActivityMutableClass: MutableClass
|
||||
lateinit var onConfigurationChangedMethod: MutableMethod
|
||||
lateinit var onCreateMethod: MutableMethod
|
||||
|
||||
private lateinit var constructorMethod: MutableMethod
|
||||
private lateinit var onBackPressedMethod: MutableMethod
|
||||
private lateinit var onCreateMethod: MutableMethod
|
||||
|
||||
private var constructorMethodIndex by Delegates.notNull<Int>()
|
||||
private var onBackPressedMethodIndex by Delegates.notNull<Int>()
|
||||
|
@ -35,6 +35,7 @@ import app.revanced.patches.youtube.utils.fingerprints.ScrollTopParentFingerprin
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.FEED_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.FEED_PATH
|
||||
import app.revanced.patches.youtube.utils.mainactivity.MainActivityResolvePatch
|
||||
import app.revanced.patches.youtube.utils.navigation.NavigationBarHookPatch
|
||||
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
@ -62,6 +63,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
|
||||
@Suppress("unused")
|
||||
@ -70,6 +72,7 @@ object FeedComponentsPatch : BaseBytecodePatch(
|
||||
description = "Adds options to hide components related to feeds.",
|
||||
dependencies = setOf(
|
||||
LithoFilterPatch::class,
|
||||
MainActivityResolvePatch::class,
|
||||
NavigationBarHookPatch::class,
|
||||
PlayerTypeHookPatch::class,
|
||||
SettingsPatch::class,
|
||||
@ -175,6 +178,27 @@ object FeedComponentsPatch : BaseBytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for hide floating button
|
||||
|
||||
MainActivityResolvePatch.onCreateMethod.apply {
|
||||
val fabIndex = indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.CONST_STRING &&
|
||||
getReference<StringReference>()?.string == "fab"
|
||||
}
|
||||
val fabRegister = getInstruction<OneRegisterInstruction>(fabIndex).registerA
|
||||
val jumpIndex = indexOfFirstInstructionOrThrow(fabIndex + 1, Opcode.CONST_STRING)
|
||||
|
||||
addInstructionsWithLabels(
|
||||
fabIndex, """
|
||||
invoke-static {}, $FEED_CLASS_DESCRIPTOR->hideFloatingButton()Z
|
||||
move-result v$fabRegister
|
||||
if-nez v$fabRegister, :hide
|
||||
""", ExternalLabel("hide", getInstruction(jumpIndex))
|
||||
)
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for hide relative video
|
||||
|
||||
fun Method.indexOfEngagementPanelBuilderInstruction(targetMethod: MutableMethod) =
|
||||
|
@ -141,6 +141,9 @@ Tap here to learn more about DeArrow."</string>
|
||||
<string name="revanced_hide_feed_survey_title">Hide feed surveys</string>
|
||||
<string name="revanced_hide_feed_survey_summary_on">Feed surveys are hidden.</string>
|
||||
<string name="revanced_hide_feed_survey_summary_off">Feed surveys are shown.</string>
|
||||
<string name="revanced_hide_floating_button_title">Hide floating button</string>
|
||||
<string name="revanced_hide_floating_button_summary_on">Floating button is hidden.</string>
|
||||
<string name="revanced_hide_floating_button_summary_off">Floating button is shown.</string>
|
||||
<string name="revanced_hide_image_shelf_title">Hide image shelves</string>
|
||||
<string name="revanced_hide_image_shelf_summary_on">Image shelves are hidden.</string>
|
||||
<string name="revanced_hide_image_shelf_summary_off">Image shelves are shown.</string>
|
||||
|
@ -106,8 +106,9 @@
|
||||
<SwitchPreference android:title="@string/revanced_hide_expandable_chip_title" android:key="revanced_hide_expandable_chip" android:summaryOn="@string/revanced_hide_expandable_chip_summary_on" android:summaryOff="@string/revanced_hide_expandable_chip_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_expandable_shelf_title" android:key="revanced_hide_expandable_shelf" android:summaryOn="@string/revanced_hide_expandable_shelf_summary_on" android:summaryOff="@string/revanced_hide_expandable_shelf_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_feed_captions_button_title" android:key="revanced_hide_feed_captions_button" android:summaryOn="@string/revanced_hide_feed_captions_button_on" android:summaryOff="@string/revanced_hide_feed_captions_button_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_feed_survey_title" android:key="revanced_hide_feed_survey" android:summaryOn="@string/revanced_hide_feed_survey_summary_on" android:summaryOff="@string/revanced_hide_feed_survey_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_feed_search_bar_title" android:key="revanced_hide_feed_search_bar" android:summaryOn="@string/revanced_hide_feed_search_bar_summary_on" android:summaryOff="@string/revanced_hide_feed_search_bar_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_feed_survey_title" android:key="revanced_hide_feed_survey" android:summaryOn="@string/revanced_hide_feed_survey_summary_on" android:summaryOff="@string/revanced_hide_feed_survey_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_floating_button_title" android:key="revanced_hide_floating_button" android:summaryOn="@string/revanced_hide_floating_button_summary_on" android:summaryOff="@string/revanced_hide_floating_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_image_shelf_title" android:key="revanced_hide_image_shelf" android:summaryOn="@string/revanced_hide_image_shelf_summary_on" android:summaryOff="@string/revanced_hide_image_shelf_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_latest_posts_title" android:key="revanced_hide_latest_posts" android:summaryOn="@string/revanced_hide_latest_posts_summary_on" android:summaryOff="@string/revanced_hide_latest_posts_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_latest_videos_button_title" android:key="revanced_hide_latest_videos_button" android:summaryOn="@string/revanced_hide_latest_videos_button_summary_on" android:summaryOff="@string/revanced_hide_latest_videos_button_summary_off" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user