[MOD][WSM] MIUI5 remove text from dock icons (updated 2013-11-16)

Discussion in 'MIUI Mods' started by Zirias, Nov 15, 2013.

  1. Zirias

    ZiriasMembers

    Nov 4, 2013
    54
    5
    18
    Male
    Software Developer
    Germany
    #1Zirias,Nov 15, 2013
    Last edited: Nov 16, 2013
    Finally a dock without stupid captions :)

    [​IMG]

    Installation:
    (1) Install WSM Tools
    (2) Install HideDockIconsText.apk
    (3) Activate "Hide Dockicons Text" in WSM Tools and reboot

    Source:
    wsm_miui5_hide_dockicons_text
    This is based on the original "Hide Icon Text" WSM module, adding a method to select only dock icons.

    Download:
    HideDockIconsText.apk (md5: 3a00322d44fef2221ac122e3612ae620)

    History:
    1.1:
    - Changed API level from 17 to 16 (4.1.2) for compatibility with all MIUI5 devices

    1.0:
    - Initial Release
     
    MarcoG: and dp4u4umi6ev like this.
  2. xeGox

    xeGoxMembers

    Feb 26, 2013
    387
    47
    60
    Male
    Wonderful news....
    But if download apk file, it says error to install(wrong download?)

    Inviato dal mio Xiaomi Mi-5f (f sta per fun,non per fan)...con tapatalk 26°
     
  3. Zirias

    ZiriasMembers

    Nov 4, 2013
    54
    5
    18
    Male
    Software Developer
    Germany
    First of all, I only have MIUI on my Mi3 right now, so this is the only tested device. This SHOULD be device independent, please give feedback, thanks ;)

    Some basic stuff you probably already checked:
    • In Security&Privacy settings allow unknown sources
    • Install WSM tools first, check some WSM modules from official repo
    Otherwise, what exactly goes wrong (Message of the installer)? A logcat snippet during the moment of failure could maybe help ...

    981d585172ba910f761098ea931a9131 *HideDockIconsText.apk
     
  4. patton82

    patton82Members

    Jan 15, 2013
    68
    10
    18
    Male
    Italy
    Cannot install on my mi2 with miui 3.11.15 and wsm tool installed and working.
    It says packet error, md5sum is right
     
  5. Zirias

    ZiriasMembers

    Nov 4, 2013
    54
    5
    18
    Male
    Software Developer
    Germany
    #5Zirias,Nov 16, 2013
    Last edited: Nov 16, 2013
    Ok, I just downloaded it myself from here, installs fine (MIUI multilang 3.11.15 on Mi3).
    Could you maybe get the exact error message from logcat? thanks!

    edit: I really don't get it -- just tried on my old HTC Sensation with AOSP 4.2.2 -- installs just fine.
     
  6. xeGox

    xeGoxMembers

    Feb 26, 2013
    387
    47
    60
    Male
    Also for me!!!

    What's the right apk size?

    Inviato dal mio Xiaomi Mi-5f (f sta per fun,non per fan)...con tapatalk 26°
     
  7. xeGox

    xeGoxMembers

    Feb 26, 2013
    387
    47
    60
    Male
    Ehm...of course!
    I have them enabled!
    I can't install apk!



    Inviato dal mio Xiaomi Mi-5f (f sta per fun,non per fan)...con tapatalk 26°
     
  8. Zirias

    ZiriasMembers

    Nov 4, 2013
    54
    5
    18
    Male
    Software Developer
    Germany
    I'm really sorry it doesn't work for you and would like to make it work. But as I'm unable to reproduce the problem on one of my devices, I need your help! Could you please e.g.
    - provide a logcat during installation attempt
    - If you have the time, build apk yourself from source and see if that works
     
  9. patton82

    patton82Members

    Jan 15, 2013
    68
    10
    18
    Male
    Italy
    I found the issue, mi2 is based on android 4.1, this apk requires a newer SDK version (4.2)
     
    Zirias likes this.
  10. Zirias

    ZiriasMembers

    Nov 4, 2013
    54
    5
    18
    Male
    Software Developer
    Germany
    #10Zirias,Nov 16, 2013
    Last edited: Nov 16, 2013
    Ah, thanks! This should be easy to fix!
    edit: fixed, please test :)
     
    xeGox likes this.
  11. xeGox

    xeGoxMembers

    Feb 26, 2013
    387
    47
    60
    Male
    Great!

    Inviato dal mio Xiaomi Mi-5f (f sta per fun,non per fan)...con tapatalk 26°
     
  12. BurgerZ

    BurgerZMembers

    Mar 17, 2012
    35
    16
    18
    Male
    Minsk
    I have added hide hotseats icons labels option to MiTools 1.4

    Отправлено с моего MI 2S при помощи Tapatalk
     
    xeGox likes this.
  13. xeGox

    xeGoxMembers

    Feb 26, 2013
    387
    47
    60
    Male
    Uhm...there isn't 1.4 mitools version...

    Inviato dal mio Xiaomi Mi-5f (f sta per fun,non per fan)...con tapatalk 26°
     
  14. BurgerZ

    BurgerZMembers

    Mar 17, 2012
    35
    16
    18
    Male
    Minsk
    I am working on this version yet.

    Отправлено с моего MI 2S при помощи Tapatalk
     
    xeGox likes this.
  15. xeGox

    xeGoxMembers

    Feb 26, 2013
    387
    47
    60
    Male
    Oh....sorry :D

    (OT for you...is it possible to implement t9 app search dialpad like one in MiHome 2.16.0?)

    Inviato dal mio Xiaomi Mi-5f (f sta per fun,non per fan)...con tapatalk 26°
     
  16. BurgerZ

    BurgerZMembers

    Mar 17, 2012
    35
    16
    18
    Male
    Minsk
    What do u mean "t9 app search dialpad"?

    Отправлено с моего MI 2S при помощи Tapatalk
     
  17. BurgerZ

    BurgerZMembers

    Mar 17, 2012
    35
    16
    18
    Male
    Minsk
    [​IMG]
    [​IMG]

    Sent from my MI 2S using Tapatalk
     
    Swos and xeGox like this.
  18. Zirias

    ZiriasMembers

    Nov 4, 2013
    54
    5
    18
    Male
    Software Developer
    Germany
    Hi BurgerZ .. first congrats on your tools, even if it was "just" modifying xposed, I guess it was a lot of work, and it's very helpful!

    Just a question here: Did you use my (kind of hacky) method of detecting dock icons? If so, a tiny attribution in Release Notes would be nice, sbasiwa. It's only a few lines of code, but it took several hours to figure out...

    And a more general suggestion: how about making all the modules opensource? I know, no one can be obliged to do so, it's just a suggestion because I think it could help a lot in order to create more useful mods :) If you like the idea, maybe we could even start general discussion of methods how to analyze (miui) system apps somewhere else!
     
  19. BurgerZ

    BurgerZMembers

    Mar 17, 2012
    35
    16
    18
    Male
    Minsk
    #19BurgerZ,Nov 20, 2013
    Last edited: Nov 20, 2013
    Hi, Zirias. Thanks.
    If you don't mind I'd like to use you code ;-) because my way is much more complicated. Also I've managed out that my method works good until you change the system language. Look:
    Code:
    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...");
            }
        }
    I could open source my modules, but....
    I can share with you any sources if it could help in modifying miui.
     
  20. Zirias

    ZiriasMembers

    Nov 4, 2013
    54
    5
    18
    Male
    Software Developer
    Germany
    #20Zirias,Nov 20, 2013
    Last edited: Nov 20, 2013
    Thanks for the snippet, so I guess you had the same idea at the same time :) Even if this code is less robust, it's much more educating; seems like you already have a good grip at the inner workings of MiHome. Of course I don't mind, I'm happy when it's working. I just asked for a small (one-time) reference in relnotes, so interested people will find how it's done on github. You see, just like I got the general idea from your repo, as stated in the OP :)

    Oh, and there's an optimization I didn't use so far: replace
    Code:
    if (lp.invoke(v).toString().startsWith("android.view.ViewGroup$LayoutParams")) {
    with
    Code:
    if (lp.invoke(v).getClass().getName().equals("android.view.ViewGroup$LayoutParams")) {
    will save a few cycles for appending the instance address that isn't used anyways.

    BTW, about robustness: My method will break at the slightest change in layout implementation -- but that's always an issue with mods ;)

    Ok, that's really antisocial... theoretically, GPL would help here, but I understand it's not worth the hassle (AND I don't like the restrictiveness of GPL anyways).
    Thanks for the offer, I'll contact you in private as soon as I have time for some modding attempts again. Really hated the obfuscated MiuiHome code...
     
  21. xeGox

    xeGoxMembers

    Feb 26, 2013
    387
    47
    60
    Male
    Pm for you

    Inviato dal mio Xiaomi Mi-5f (f sta per fun,non per fan)...con tapatalk 26°
     
  22. frizal07

    frizal07Members

    Dec 27, 2013
    12
    1
    13
    Male
    heyyy all ... how to enable or add new dock for miui v5 ?? i was download .mtz file for dock and import them on theme store.. but still nothing happend ... can anyone can tell me step by step how to add custom dock ??

    sorry for my bad english
     

Share Our Site