Skip to content

Commit

Permalink
refactor(music/settings): improve UI
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Sep 5, 2023
1 parent 02b54ca commit 0553584
Show file tree
Hide file tree
Showing 51 changed files with 203 additions and 163 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.compactdialog.fingerprints
package app.revanced.patches.music.flyoutpanel.compactdialog.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.compactdialog.patch
package app.revanced.patches.music.flyoutpanel.compactdialog.patch

import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
Expand All @@ -9,12 +9,12 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.layout.compactdialog.fingerprints.DialogSolidFingerprint
import app.revanced.patches.music.flyoutpanel.compactdialog.fingerprints.DialogSolidFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT

@Patch
@Name("Enable compact dialog")
Expand All @@ -39,15 +39,15 @@ class CompactDialogPatch : BytecodePatch(
) {
addInstructions(
2, """
invoke-static {p0}, $MUSIC_LAYOUT->enableCompactDialog(I)I
invoke-static {p0}, $MUSIC_FLYOUT->enableCompactDialog(I)I
move-result p0
"""
)
}
} ?: throw DialogSolidFingerprint.exception

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.FLYOUT,
"revanced_enable_compact_dialog",
"true"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.sleeptimer.fingerprints
package app.revanced.patches.music.flyoutpanel.sleeptimer.fingerprints

import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.util.bytecode.isWide32LiteralExists
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.sleeptimer.patch
package app.revanced.patches.music.flyoutpanel.sleeptimer.patch

import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
Expand All @@ -9,11 +9,11 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.sleeptimer.fingerprints.SleepTimerFingerprint
import app.revanced.patches.music.flyoutpanel.sleeptimer.fingerprints.SleepTimerFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction

@Patch
Expand All @@ -33,15 +33,15 @@ class SleepTimerPatch : BytecodePatch(

addInstructions(
insertIndex, """
invoke-static {}, $MUSIC_LAYOUT->enableSleepTimer()Z
invoke-static {}, $MUSIC_FLYOUT->enableSleepTimer()Z
move-result v$targetRegister
"""
)
}
} ?: throw SleepTimerFingerprint.exception

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.FLYOUT,
"revanced_enable_sleep_timer",
"true"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.amoled.patch
package app.revanced.patches.music.general.amoled.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.autocaptions.patch
package app.revanced.patches.music.general.autocaptions.patch

import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
Expand All @@ -13,7 +13,7 @@ import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.shared.fingerprints.captions.SubtitleTrackFingerprint
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction

@Patch
Expand All @@ -33,15 +33,15 @@ class DisableAutoCaptionsPatch : BytecodePatch(

addInstructions(
index, """
invoke-static {v$register}, $MUSIC_LAYOUT->disableAutoCaptions(Z)Z
invoke-static {v$register}, $MUSIC_GENERAL->disableAutoCaptions(Z)Z
move-result v$register
"""
)
}
} ?: throw SubtitleTrackFingerprint.exception

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_disable_auto_captions",
"false"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.branding.icon.patch
package app.revanced.patches.music.general.branding.icon.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.branding.icon.patch
package app.revanced.patches.music.general.branding.icon.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.branding.icon.patch
package app.revanced.patches.music.general.branding.icon.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.buttonshelf.patch
package app.revanced.patches.music.general.buttonshelf.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
Expand Down Expand Up @@ -26,7 +26,7 @@ class HideButtonShelfPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_hide_button_shelf",
"false"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.carouselshelf.patch
package app.revanced.patches.music.general.carouselshelf.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
Expand Down Expand Up @@ -26,7 +26,7 @@ class HideCarouselShelfPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_hide_carousel_shelf",
"false"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.castbutton.fingerprints
package app.revanced.patches.music.general.castbutton.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.castbutton.fingerprints
package app.revanced.patches.music.general.castbutton.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.castbutton.patch
package app.revanced.patches.music.general.castbutton.patch

import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
Expand All @@ -9,12 +9,12 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonFingerprint
import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonParentFingerprint
import app.revanced.patches.music.general.castbutton.fingerprints.HideCastButtonFingerprint
import app.revanced.patches.music.general.castbutton.fingerprints.HideCastButtonParentFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
import app.revanced.util.integrations.Constants.MUSIC_GENERAL

@Patch
@Name("Hide cast button")
Expand All @@ -34,14 +34,14 @@ class HideCastButtonPatch : BytecodePatch(
)
}.result?.mutableMethod?.addInstructions(
0, """
invoke-static {p1}, $MUSIC_LAYOUT->hideCastButton(I)I
invoke-static {p1}, $MUSIC_GENERAL->hideCastButton(I)I
move-result p1
"""
) ?: throw HideCastButtonFingerprint.exception
} ?: throw HideCastButtonParentFingerprint.exception

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_hide_cast_button",
"true"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.categorybar.fingerprints
package app.revanced.patches.music.general.categorybar.fingerprints

import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.ChipCloud
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.categorybar.patch
package app.revanced.patches.music.general.categorybar.patch

import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
Expand All @@ -9,12 +9,12 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.categorybar.fingerprints.ChipCloudFingerprint
import app.revanced.patches.music.general.categorybar.fingerprints.ChipCloudFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction

@Patch
Expand All @@ -38,13 +38,13 @@ class CategoryBarPatch : BytecodePatch(

addInstruction(
targetIndex + 1,
"invoke-static { v$targetRegister }, $MUSIC_LAYOUT->hideCategoryBar(Landroid/view/View;)V"
"invoke-static { v$targetRegister }, $MUSIC_GENERAL->hideCategoryBar(Landroid/view/View;)V"
)
}
} ?: throw ChipCloudFingerprint.exception

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_hide_category_bar",
"true"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.carouselshelf.patch
package app.revanced.patches.music.general.channelguidelines.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
Expand Down Expand Up @@ -26,7 +26,7 @@ class HideChannelGuidelinesPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_hide_channel_guidelines",
"true"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.customfilter.patch
package app.revanced.patches.music.general.customfilter.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
Expand Down Expand Up @@ -26,12 +26,12 @@ class CustomFilterPatch : ResourcePatch {
override fun execute(context: ResourceContext) {

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_custom_filter",
"false"
)
SettingsPatch.addMusicPreferenceWithIntent(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_custom_filter_strings",
"revanced_custom_filter"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.floatingbutton.fingerprints
package app.revanced.patches.music.general.floatingbutton.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.floatingbutton.fingerprints
package app.revanced.patches.music.general.floatingbutton.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.floatingbutton.patch
package app.revanced.patches.music.general.floatingbutton.patch

import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
Expand All @@ -11,13 +11,13 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.layout.floatingbutton.fingerprints.FloatingButtonFingerprint
import app.revanced.patches.music.layout.floatingbutton.fingerprints.FloatingButtonParentFingerprint
import app.revanced.patches.music.general.floatingbutton.fingerprints.FloatingButtonFingerprint
import app.revanced.patches.music.general.floatingbutton.fingerprints.FloatingButtonParentFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
import app.revanced.util.integrations.Constants.MUSIC_GENERAL

@Patch
@Name("Hide new playlist button")
Expand All @@ -44,7 +44,7 @@ class NewPlaylistButtonPatch : BytecodePatch(
it.mutableMethod.apply {
addInstructionsWithLabels(
1, """
invoke-static {}, $MUSIC_LAYOUT->hideNewPlaylistButton()Z
invoke-static {}, $MUSIC_GENERAL->hideNewPlaylistButton()Z
move-result v0
if-eqz v0, :show
return-void
Expand All @@ -55,7 +55,7 @@ class NewPlaylistButtonPatch : BytecodePatch(
} ?: throw FloatingButtonParentFingerprint.exception

SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
CategoryType.GENERAL,
"revanced_hide_new_playlist_button",
"false"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.landscapemode.fingerprints
package app.revanced.patches.music.general.landscapemode.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
Expand Down
Loading

0 comments on commit 0553584

Please sign in to comment.