Question

I came across a launcher app named Nova Launcher which providing option to change look & feel of system applications to another icon pack, below is the screenshot from nova launcher.

shcreenshot from nova launcher

When I'll select stock jellybean it will replace system application icon to jellbean icon pack.

I want to implement same functionality in my own launcher app, I Google but not found anything related, need guide and suggestion.

I tried to set Example-theme simply changing package name but its gives me force close that com.mypackagename not found.

Main Activity@

private static final String ACTION_APPLY_ICON_THEME = "com.mypackage.launcher.APPLY_ICON_THEME";
    private static final String NOVA_PACKAGE = "com.mypackage.launcher";
    private static final String EXTRA_ICON_THEME_PACKAGE = "com.mypackage.launcher.extra.ICON_THEME_PACKAGE";

//    private static final String ACTION_APPLY_ICON_THEME = "com.teslacoilsw.launcher.APPLY_ICON_THEME";
//    private static final String NOVA_PACKAGE = "com.teslacoilsw.launcher";
//    private static final String EXTRA_ICON_THEME_PACKAGE = "com.teslacoilsw.launcher.extra.ICON_THEME_PACKAGE";

I'm just looking a way that what should I manage or code inside my own launcher to set such themes same as nova launcher.

Below links help me to create themes for launcher but not found any way to set/apply to my launcher.

Launcher Theme Tutorial

Example-theme

Your suggestion are appreciable.

Was it helpful?

Solution

Mr. Robin is right.. You can do it manually..

Put all your custom icon in drawable folder with specific name like as icon_appname.png..

icon_contacts.png, icon_camera.png, icon_settings.png, icon_phone.png, icon_email.png...etc

or you can also save images as package name also like as icon_com_android_camera.png...etc

Just put condition in your GetView in Adapter Class.

        if(User selected default theme)
        {
        //use default icon from system
        }
        else
        {
            String appname = here is app name;
            String appPackageName = here is app package name;
            // You can use appname or appPackageName as per your drawable name.
            int intResource = getResources().getIdentifier("icon_" + appname.toLowerCase(), "drawable", getPackageName());
            if(intResNormal!=0)
                holder.txtTitle.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(intResource), null, null);
            else
                //use default icon when no resource found
        }

Note: If you are following as package name so don't forgot to replace "_" with "."

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top