Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ホームでのサービス項目を削除 #196

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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());
}
}
);
Expand All @@ -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);
}
*/
}