Skip to content

Instantly share code, notes, and snippets.

@BurgerZ
Created November 22, 2014 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BurgerZ/d55d3cb80a9485324ecd to your computer and use it in GitHub Desktop.
Save BurgerZ/d55d3cb80a9485324ecd to your computer and use it in GitHub Desktop.
Hide hotseats icons labels in MIUI v5 (maybe v6 too) with Xposed/WSM
private static void hideHotSeatsLabels() {
try {
Class.forName("com.miui.home.launcher.ShortcutIcon", false, mClassLoader);
XposedHelpers.findAndHookMethod("com.miui.home.launcher.ShortcutIcon", mClassLoader,
"onFinishInflate", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
hide(param);
}
});
} catch (ClassNotFoundException ignored) {
Utils.log("[HotSeats] Class not found! Skipping...");
} catch (NoSuchMethodError ignored) {
Utils.log("[HotSeats] Method not found! Skipping...");
}
try {
Class.forName("com.miui.home.launcher.FolderIcon", false, mClassLoader);
XposedHelpers.findAndHookMethod("com.miui.home.launcher.FolderIcon", mClassLoader,
"onFinishInflate", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
hide(param);
}
});
} catch (ClassNotFoundException ignored) {
Utils.log("[HotSeats] Class not found! Skipping...");
} catch (NoSuchMethodError ignored) {
Utils.log("[HotSeats] Method not found! Skipping...");
}
}
private void hide(MethodHookParam param) throws Throwable {
FrameLayout v = (FrameLayout) param.thisObject;
Method lp = v.getClass().getMethod("getLayoutParams");
if (lp == null)
return;
try {
if (lp.invoke(v).getClass().getName().equals("android.view.ViewGroup$LayoutParams")) {
final Context context = v.getContext();
int resID = context.getResources().getIdentifier("icon_title", "id", "com.miui.home");
TextView tv = (TextView) v.findViewById(resID);
tv.setVisibility(View.INVISIBLE);
}
} catch (Exception ignored) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment