4

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.

RobinHood
  • 10,897
  • 4
  • 48
  • 97
  • I don't get it. I think as long as you are implementing your own home screen application, any icon displaying is under your control. You can display any image for any application icon, right? – Robin Sep 09 '13 at 07:12
  • If you are familiar with nova launcher then you will easily get it, thing is, not found a way that what I should code inside launcher to apply theme as others launcher doing. – RobinHood Sep 09 '13 at 07:14
  • I think user Robin is correct. The option to choose theme is just that: an option. You'll save the user's selected theme and load the system/application icons based on it. Look at `ApplicationsAdapter.java` from project `android-launcher-plus`(an open source launcher): [Link](http://code.google.com/p/android-launcher-plus/source/browse/trunk/src/mobi/intuitit/android/p/launcher/ApplicationsAdapter.java). The icon, and its look and feel, is in _your_ control. Write a `Util` method to figure out which icons need to be changed, and handle them accordingly. – Vikram Sep 09 '13 at 07:37

1 Answers1

4

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 "."

Niranj Patel
  • 32,980
  • 10
  • 97
  • 133