Created
November 22, 2014 08:31
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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