fix: prepare for hide-suggestions patch (#35)

This commit is contained in:
Joey Peter 2022-07-02 00:26:02 +02:00 committed by oSumAtrIX
parent 3a2655b38b
commit 0ce6aa854c
5 changed files with 15 additions and 31 deletions

View File

@ -73,30 +73,17 @@ public class AdRemoverAPI {
} }
} }
/**
* Removes the InfoCardSuggestions
*
* @param InfoCardOverlayPresenter
* @return
*/
public static Object removeInfoCardSuggestions(Object InfoCardOverlayPresenter) {
if (!SettingsEnum.INFO_CARDS_SHOWN_BOOLEAN.getBoolean()) InfoCardOverlayPresenter = null;
String message = InfoCardOverlayPresenter == null ? "RemoveInfoCardSuggestions: true" : "RemoveInfoCardSuggestions: false";
LogHelper.debug(AdRemoverAPI.class, message);
return InfoCardOverlayPresenter;
}
/** /**
* Removes the Suggestions * Removes the Suggestions
* *
* @param showSuggestions
* @return * @return
*/ */
public static Boolean removeSuggestions(Boolean showSuggestions) { public static void hideSuggestions(View view) {
if (!SettingsEnum.SUGGESTIONS_SHOWN_BOOLEAN.getBoolean()) showSuggestions = false; String message = SettingsEnum.SUGGESTIONS_SHOWN_BOOLEAN.getBoolean() ? "Infocard suggestions: shown" : "Infocards: hidden";
String message = showSuggestions ? "RemoveSuggestions: true" : "RemoveSuggestions: false";
LogHelper.debug(AdRemoverAPI.class, message); LogHelper.debug(AdRemoverAPI.class, message);
return showSuggestions; if (!SettingsEnum.SUGGESTIONS_SHOWN_BOOLEAN.getBoolean()) {
view.setVisibility(View.GONE);
}
} }
/* /*

View File

@ -4,8 +4,8 @@ import app.revanced.integrations.settings.SettingsEnum;
public class AutoRepeatPatch { public class AutoRepeatPatch {
//ToDo: Write Patch for it.
//See https://drive.google.com/file/d/1hLl71Mm3oAtgTjNvsYZi3CUutCPx2gjS/view?usp=sharing for where it needs to be used. //Used by app.revanced.patches.youtube.layout.autorepeat.patch.AutoRepeatPatch
public static boolean shouldAutoRepeat() { public static boolean shouldAutoRepeat() {
return SettingsEnum.PREFERRED_AUTO_REPEAT_BOOLEAN.getBoolean(); return SettingsEnum.PREFERRED_AUTO_REPEAT_BOOLEAN.getBoolean();
} }

View File

@ -5,8 +5,7 @@ import app.revanced.integrations.videoswipecontrols.helpers.BrightnessHelper;
public class HDRMaxBrightnessPatch { public class HDRMaxBrightnessPatch {
//ToDo: Write Patch for it. //Used by app/revanced/patches/youtube/misc/hdrbrightness/patch/HDRBrightnessPatch
//See https://drive.google.com/file/d/1rIJzsaMQouH_2__EcVY5Dg6l7ji9vsyP/view?usp=sharing for where it needs to be used.
public static float getHDRBrightness(float original) { public static float getHDRBrightness(float original) {
if (!SettingsEnum.USE_HDR_BRIGHTNESS_BOOLEAN.getBoolean()) return original; if (!SettingsEnum.USE_HDR_BRIGHTNESS_BOOLEAN.getBoolean()) return original;
return SettingsEnum.ENABLE_SWIPE_BRIGHTNESS_BOOLEAN.getBoolean() ? BrightnessHelper.getBrightness() : -1.0f; return SettingsEnum.ENABLE_SWIPE_BRIGHTNESS_BOOLEAN.getBoolean() ? BrightnessHelper.getBrightness() : -1.0f;

View File

@ -1,12 +1,10 @@
package app.revanced.integrations.patches; package app.revanced.integrations.patches;
import app.revanced.integrations.adremover.AdRemoverAPI; import app.revanced.integrations.settings.SettingsEnum;
public class HideInfoCardSuggestionsPatch { public class HideInfoCardSuggestionsPatch {
//TODO: Create Patch public static int hideInfoCardSuggestions() {
//Not used yet return SettingsEnum.INFO_CARDS_SHOWN_BOOLEAN.getBoolean() ? 0 : 8;
public static void HideInfoCardSuggestions(Object InfoCardOverlayPresenter) {
AdRemoverAPI.removeInfoCardSuggestions(InfoCardOverlayPresenter);
} }
} }

View File

@ -1,13 +1,13 @@
package app.revanced.integrations.patches; package app.revanced.integrations.patches;
import android.view.View;
import app.revanced.integrations.adremover.AdRemoverAPI; import app.revanced.integrations.adremover.AdRemoverAPI;
public class HideSuggestionsPatch { public class HideSuggestionsPatch {
//TODO: Create Patch public static void hideSuggestions(View view) {
//Not used yet AdRemoverAPI.hideSuggestions(view);
public static void HideSuggestions(boolean showSuggestions) {
AdRemoverAPI.removeSuggestions(showSuggestions);
} }
} }