mirror of
https://github.com/revanced/revanced-integrations
synced 2024-11-24 20:07:14 +01:00
fix: make all patches toggleable with settings (#87)
This commit is contained in:
parent
0e01041ee3
commit
6d3d274599
@ -0,0 +1,13 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class FullscreenPanelsRemoverPatch {
|
||||
|
||||
public int getFullsceenPanelsVisibility() {
|
||||
return SettingsEnum.FULLSCREEN_PANELS_SHOWN.getBoolean() ? View.VISIBLE : View.GONE;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideAutoplayButtonPatch {
|
||||
|
||||
public static boolean isButtonShown() {
|
||||
return SettingsEnum.AUTOPLAY_BUTTON_SHOWN.getBoolean();
|
||||
}
|
||||
|
||||
public static boolean isButtonHidden() {
|
||||
return !isButtonShown();
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,9 @@ import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideInfoCardSuggestionsPatch {
|
||||
|
||||
public static int hideInfoCardSuggestions() {
|
||||
return SettingsEnum.INFO_CARDS_SHOWN.getBoolean() ? View.VISIBLE : View.GONE;
|
||||
public static void hideInfoCardSuggestions(View view) {
|
||||
if (!SettingsEnum.INFO_CARDS_SHOWN.getBoolean()) {
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class MinimizedPlaybackPatch {
|
||||
|
||||
public static boolean isMinimizedPlaybackEnabled() {
|
||||
return SettingsEnum.ENABLE_MINIMIZED_PLAYBACK.getBoolean();
|
||||
}
|
||||
|
||||
}
|
@ -52,10 +52,12 @@ public enum SettingsEnum {
|
||||
INFO_CARDS_SHOWN("revanced_info_cards_enabled", false, ReturnType.BOOLEAN),
|
||||
BRANDING_SHOWN("revanced_branding_watermark_enabled", false, ReturnType.BOOLEAN),
|
||||
CAST_BUTTON_SHOWN("revanced_cast_button_enabled", false, ReturnType.BOOLEAN),
|
||||
AUTOPLAY_BUTTON_SHOWN("revanced_autoplay_button_enabled", false, ReturnType.BOOLEAN), //ToDo: Add to prefs
|
||||
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", false, ReturnType.BOOLEAN),
|
||||
CREATE_BUTTON_SHOWN("revanced_create_button_enabled", false, ReturnType.BOOLEAN),
|
||||
USE_NEW_ACTIONBAR("revanced_new_actionbar", true, ReturnType.BOOLEAN),
|
||||
SHORTS_BUTTON_SHOWN("revanced_shorts_button_enabled", false, ReturnType.BOOLEAN),
|
||||
FULLSCREEN_PANELS_SHOWN("revanced_fullscreen_panels_enabled", false, ReturnType.BOOLEAN), //ToDo: Add to prefs
|
||||
|
||||
//Misc. Settings
|
||||
AUTOREPEAT_BUTTON_SHOWN("revanced_pref_auto_repeat_button", false, ReturnType.BOOLEAN),
|
||||
@ -63,6 +65,7 @@ public enum SettingsEnum {
|
||||
PREFERRED_AUTO_REPEAT("revanced_pref_auto_repeat", true, ReturnType.BOOLEAN),
|
||||
USE_HDR_AUTO_BRIGHTNESS("revanced_pref_hdr_autobrightness", true, ReturnType.BOOLEAN),
|
||||
TAP_SEEKING_ENABLED("revanced_enable_tap_seeking", true, ReturnType.BOOLEAN),
|
||||
ENABLE_MINIMIZED_PLAYBACK("revanced_enable_minimized_playback", true, ReturnType.BOOLEAN),
|
||||
|
||||
//Swipe controls
|
||||
ENABLE_SWIPE_BRIGHTNESS("revanced_enable_swipe_brightness", true, ReturnType.BOOLEAN),
|
||||
|
@ -1,9 +1,7 @@
|
||||
package app.revanced.integrations.sponsorblock;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -14,17 +12,6 @@ public class StringRef {
|
||||
private static Resources resources;
|
||||
private static String packageName;
|
||||
|
||||
/**
|
||||
* Called in Application onCreate, should be called as soon as possible when after application startup
|
||||
*
|
||||
* @param context Any context, it will be used to obtain string resources
|
||||
*/
|
||||
public static void setContext(Context context) {
|
||||
if (context == null) return;
|
||||
resources = context.getApplicationContext().getResources();
|
||||
packageName = context.getPackageName();
|
||||
}
|
||||
|
||||
private static final HashMap<String, StringRef> strings = new HashMap<>();
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user