private static void hideHotSeatsLabels() {
try {
Class.forName("com.miui.home.launcher.Launcher", false, mClassLoader);
XposedHelpers.findAndHookMethod("com.miui.home.launcher.Launcher", mClassLoader,
"onCreate", Bundle.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Class<?> launcher = Class.forName("com.miui.home.launcher.Launcher", false, mClassLoader);
Class<?> hotseats = Class.forName("com.miui.home.launcher.HotSeats", false, mClassLoader);
Field[] ff = XposedHelpers.findFieldsByExactType(launcher, hotseats);
for (Field f : ff) {
View vg = (View) XposedHelpers.getObjectField(param.thisObject, f.getName());
//if (vg instanceof TextView) vg.setAlpha(0.1f);
String[] COLUMNS = { "_id", "intent", "title", "iconType", "icon", "iconPackage", "iconResource", "container", "itemType", "appWidgetId", "screen", "cellX", "cellY", "spanX", "spanY", "uri", "displayMode", "launchCount", "sortMode", "itemFlags" };
ContentResolver cr = vg.getContext().getContentResolver();
Uri localUri = Uri.parse("content://com.miui.home.launcher.settings/favorites");
String[] arrayOfString1 = COLUMNS;
String[] arrayOfString2 = new String[1];
arrayOfString2[0] = "-101";
Cursor cursor = cr.query(localUri, arrayOfString1, "container=?", arrayOfString2, null);
while (cursor.moveToNext()) {
final String title = cursor.getString(cursor.getColumnIndex("title"));
Class<?> itemIcon = Class.forName("com.miui.home.launcher.ShortcutIcon", false, mClassLoader).getSuperclass();
XposedHelpers.findAndHookMethod(itemIcon,
"setTitle", CharSequence.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
CharSequence title_ = (CharSequence) param.args[0];
if (title_.toString().equals(title))
param.args[0] = "";
return;
}
});
}
cursor.close();
}
}
});
} catch (ClassNotFoundException ignored) {
Utils.log("[HotSeats] Class not found! Skipping...");
} catch (NoSuchMethodError ignored) {
Utils.log("[HotSeats] Method \""+ignored.getMessage()+"\" not found! Skipping...");
}
}