Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit 6d3d274

Browse files
authored
fix: make all patches toggleable with settings (#87)
1 parent 0e01041 commit 6d3d274

6 files changed

Lines changed: 46 additions & 15 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package app.revanced.integrations.patches;
2+
3+
import android.view.View;
4+
5+
import app.revanced.integrations.settings.SettingsEnum;
6+
7+
public class FullscreenPanelsRemoverPatch {
8+
9+
public int getFullsceenPanelsVisibility() {
10+
return SettingsEnum.FULLSCREEN_PANELS_SHOWN.getBoolean() ? View.VISIBLE : View.GONE;
11+
}
12+
13+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package app.revanced.integrations.patches;
2+
3+
import app.revanced.integrations.settings.SettingsEnum;
4+
5+
public class HideAutoplayButtonPatch {
6+
7+
public static boolean isButtonShown() {
8+
return SettingsEnum.AUTOPLAY_BUTTON_SHOWN.getBoolean();
9+
}
10+
11+
public static boolean isButtonHidden() {
12+
return !isButtonShown();
13+
}
14+
15+
}

app/src/main/java/app/revanced/integrations/patches/HideInfoCardSuggestionsPatch.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
public class HideInfoCardSuggestionsPatch {
88

9-
public static int hideInfoCardSuggestions() {
10-
return SettingsEnum.INFO_CARDS_SHOWN.getBoolean() ? View.VISIBLE : View.GONE;
9+
public static void hideInfoCardSuggestions(View view) {
10+
if (!SettingsEnum.INFO_CARDS_SHOWN.getBoolean()) {
11+
view.setVisibility(View.GONE);
12+
}
1113
}
1214
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package app.revanced.integrations.patches;
2+
3+
import app.revanced.integrations.settings.SettingsEnum;
4+
5+
public class MinimizedPlaybackPatch {
6+
7+
public static boolean isMinimizedPlaybackEnabled() {
8+
return SettingsEnum.ENABLE_MINIMIZED_PLAYBACK.getBoolean();
9+
}
10+
11+
}

app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,20 @@ public enum SettingsEnum {
5252
INFO_CARDS_SHOWN("revanced_info_cards_enabled", false, ReturnType.BOOLEAN),
5353
BRANDING_SHOWN("revanced_branding_watermark_enabled", false, ReturnType.BOOLEAN),
5454
CAST_BUTTON_SHOWN("revanced_cast_button_enabled", false, ReturnType.BOOLEAN),
55+
AUTOPLAY_BUTTON_SHOWN("revanced_autoplay_button_enabled", false, ReturnType.BOOLEAN), //ToDo: Add to prefs
5556
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", false, ReturnType.BOOLEAN),
5657
CREATE_BUTTON_SHOWN("revanced_create_button_enabled", false, ReturnType.BOOLEAN),
5758
USE_NEW_ACTIONBAR("revanced_new_actionbar", true, ReturnType.BOOLEAN),
5859
SHORTS_BUTTON_SHOWN("revanced_shorts_button_enabled", false, ReturnType.BOOLEAN),
60+
FULLSCREEN_PANELS_SHOWN("revanced_fullscreen_panels_enabled", false, ReturnType.BOOLEAN), //ToDo: Add to prefs
5961

6062
//Misc. Settings
6163
AUTOREPEAT_BUTTON_SHOWN("revanced_pref_auto_repeat_button", false, ReturnType.BOOLEAN),
6264
AUTO_CAPTIONS_ENABLED("revanced_pref_auto_captions", false, ReturnType.BOOLEAN),
6365
PREFERRED_AUTO_REPEAT("revanced_pref_auto_repeat", true, ReturnType.BOOLEAN),
6466
USE_HDR_AUTO_BRIGHTNESS("revanced_pref_hdr_autobrightness", true, ReturnType.BOOLEAN),
6567
TAP_SEEKING_ENABLED("revanced_enable_tap_seeking", true, ReturnType.BOOLEAN),
68+
ENABLE_MINIMIZED_PLAYBACK("revanced_enable_minimized_playback", true, ReturnType.BOOLEAN),
6669

6770
//Swipe controls
6871
ENABLE_SWIPE_BRIGHTNESS("revanced_enable_swipe_brightness", true, ReturnType.BOOLEAN),

app/src/main/java/app/revanced/integrations/sponsorblock/StringRef.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package app.revanced.integrations.sponsorblock;
22

3-
import android.content.Context;
43
import android.content.res.Resources;
54

6-
75
import androidx.annotation.NonNull;
86

97
import java.util.HashMap;
@@ -14,17 +12,6 @@ public class StringRef {
1412
private static Resources resources;
1513
private static String packageName;
1614

17-
/**
18-
* Called in Application onCreate, should be called as soon as possible when after application startup
19-
*
20-
* @param context Any context, it will be used to obtain string resources
21-
*/
22-
public static void setContext(Context context) {
23-
if (context == null) return;
24-
resources = context.getApplicationContext().getResources();
25-
packageName = context.getPackageName();
26-
}
27-
2815
private static final HashMap<String, StringRef> strings = new HashMap<>();
2916

3017
/**

0 commit comments

Comments
 (0)