From 48496680129e9dd61109ffad1952a266a846d009 Mon Sep 17 00:00:00 2001 From: areteruhiro <108941410+areteruhiro@users.noreply.github.com> Date: Mon, 21 Oct 2024 18:32:14 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=9B=E3=83=BC=E3=83=A0=E3=81=A7=E3=81=AE?= =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=93=E3=82=B9=E9=A0=85=E7=9B=AE=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4=20(#196)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Syuugo --- .../lime/hooks/RemoveFlexibleContents.java | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/github/chipppppppppp/lime/hooks/RemoveFlexibleContents.java b/app/src/main/java/io/github/chipppppppppp/lime/hooks/RemoveFlexibleContents.java index 873838d7..493462da 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/hooks/RemoveFlexibleContents.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/hooks/RemoveFlexibleContents.java @@ -12,6 +12,8 @@ public class RemoveFlexibleContents implements IHook { int recommendationResId, serviceNameResId, notificationResId; + int serviceRowContainerResId, serviceIconResId, serviceCarouselResId; + int serviceTitleBackgroundResId, serviceTitleResId, serviceSeeMoreResId, serviceSeeMoreBadgeResId; @Override public void hook(LimeOptions limeOptions, XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable { @@ -25,6 +27,13 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { recommendationResId = context.getResources().getIdentifier("home_tab_contents_recommendation_placement", "id", context.getPackageName()); serviceNameResId = context.getResources().getIdentifier("home_tab_service_name", "id", context.getPackageName()); notificationResId = context.getResources().getIdentifier("notification_hub_row_rolling_view_group", "id", context.getPackageName()); + serviceRowContainerResId = context.getResources().getIdentifier("service_row_container", "id", context.getPackageName()); + serviceIconResId = context.getResources().getIdentifier("home_tab_service_icon", "id", context.getPackageName()); + serviceCarouselResId = context.getResources().getIdentifier("home_tab_service_carousel", "id", context.getPackageName()); + serviceTitleBackgroundResId = context.getResources().getIdentifier("home_tab_service_title_background", "id", context.getPackageName()); + serviceTitleResId = context.getResources().getIdentifier("home_tab_service_title", "id", context.getPackageName()); + serviceSeeMoreResId = context.getResources().getIdentifier("home_tab_service_see_more", "id", context.getPackageName()); + serviceSeeMoreBadgeResId = context.getResources().getIdentifier("home_tab_service_see_more_badge", "id", context.getPackageName()); } } ); @@ -33,22 +42,37 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { View.class, "onAttachedToWindow", new XC_MethodHook() { - View view; - @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { - view = (View) param.thisObject; - if (limeOptions.removeRecommendation.checked && view.getId() == recommendationResId - || limeOptions.removeServiceLabels.checked && view.getId() == serviceNameResId) { + View view = (View) param.thisObject; + int viewId = view.getId(); + //String resourceName = getResourceName(view.getContext(), viewId); + //XposedBridge.log("View ID: " + viewId + ", Resource Name: " + resourceName); + + if (limeOptions.removeRecommendation.checked && viewId == recommendationResId + || limeOptions.removeServiceLabels.checked && viewId == serviceNameResId + || viewId == serviceRowContainerResId + || viewId == serviceIconResId + || viewId == serviceCarouselResId + || viewId == serviceTitleBackgroundResId + || viewId == serviceTitleResId + || viewId == serviceSeeMoreResId + || viewId == serviceSeeMoreBadgeResId) { ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); layoutParams.height = 0; view.setLayoutParams(layoutParams); view.setVisibility(View.GONE); - } else if (view.getId() == notificationResId) { + } else if (viewId == notificationResId) { ((View) view.getParent()).setVisibility(View.GONE); } } } ); } + + /* + private String getResourceName(Context context, int resourceId) { + return context.getResources().getResourceEntryName(resourceId); + } + */ }