Skip to content

Commit 50fd03b

Browse files
committed
Improve CustomView performance
Signed-off-by: Dev4Mod <[email protected]>
1 parent a8be399 commit 50fd03b

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ public void registerView(StyleSheet sheet) {
176176
mapIds.put(id, list);
177177
}
178178
}
179-
XposedHelpers.findAndHookMethod(View.class, "invalidate", boolean.class, new XC_MethodHook() {
179+
180+
XposedHelpers.findAndHookMethod(View.class, "requestLayout", new XC_MethodHook() {
180181
@Override
181182
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
182183
if (ReflectionUtils.isCalledFromClass(CustomView.class)) return;
@@ -196,6 +197,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
196197
}, Utils.getExecutor());
197198
}
198199
});
200+
199201
}
200202

201203

app/src/main/java/com/wmods/wppenhacer/xposed/utils/ReflectionUtils.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,11 @@ public static boolean isCalledFromStrings(String... contains) {
228228

229229
public static boolean isClassSimpleNameString(Class<?> aClass, String s) {
230230
try {
231-
Class<?> search = XposedHelpers.findClassIfExists("android.view." + s, aClass.getClassLoader());
232-
if (search != null)
233-
search = XposedHelpers.findClassIfExists("android.widget." + s, aClass.getClassLoader());
234-
Class<?> cls = aClass;
231+
var cls = aClass;
235232
do {
236-
if (search != null) {
237-
if (cls.getName().equals(search.getName())) return true;
238-
if (cls.getName().startsWith("android.widget.") || cls.getName().startsWith("android.view."))
239-
return false;
240-
} else {
241-
if (cls.getSimpleName().contains(s)) return true;
242-
}
233+
if (cls.getSimpleName().equals(s)) return true;
234+
if (cls.getName().startsWith("android.widget.") || cls.getName().startsWith("android.view."))
235+
return false;
243236
} while ((cls = cls.getSuperclass()) != null);
244237
} catch (Exception ignored) {
245238
}

0 commit comments

Comments
 (0)