From 71e81a6473b94c5a2c82a9aad340799ff174bdf7 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Wed, 21 Dec 2022 14:37:05 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20revert=20semantically=20incorrect=20simp?= =?UTF-8?q?lification=20of=20=CB=8BAdRemoverAPI.HideViewWithLayout1dp?= =?UTF-8?q?=CB=8B=20(#244)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../integrations/adremover/AdRemoverAPI.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/adremover/AdRemoverAPI.java b/app/src/main/java/app/revanced/integrations/adremover/AdRemoverAPI.java index 770a6af0..63dfed33 100644 --- a/app/src/main/java/app/revanced/integrations/adremover/AdRemoverAPI.java +++ b/app/src/main/java/app/revanced/integrations/adremover/AdRemoverAPI.java @@ -3,6 +3,11 @@ package app.revanced.integrations.adremover; import android.view.View; import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.Toolbar; + import app.revanced.integrations.utils.LogHelper; public class AdRemoverAPI { @@ -14,12 +19,24 @@ public class AdRemoverAPI { */ //ToDo: refactor this public static void HideViewWithLayout1dp(View view) { - if (view instanceof ViewGroup) { - ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(1, 1); + if (view instanceof LinearLayout) { + LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(1, 1); view.setLayoutParams(layoutParams); - return; + } else if (view instanceof FrameLayout) { + FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(1, 1); + view.setLayoutParams(layoutParams2); + } else if (view instanceof RelativeLayout) { + RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(1, 1); + view.setLayoutParams(layoutParams3); + } else if (view instanceof Toolbar) { + Toolbar.LayoutParams layoutParams4 = new Toolbar.LayoutParams(1, 1); + view.setLayoutParams(layoutParams4); + } else if (view instanceof ViewGroup) { + ViewGroup.LayoutParams layoutParams5 = new ViewGroup.LayoutParams(1, 1); + view.setLayoutParams(layoutParams5); + } else { + LogHelper.printDebug(() -> "HideViewWithLayout1dp - Id: " + view.getId() + " Type: " + view.getClass().getName()); } - LogHelper.printDebug( - () -> "HideViewWithLayout1dp - Id: " + view.getId() + " Type: " + view.getClass().getName()); } + }