[Sony Cross-Device Development Themes and Apps] serajr:
I proudly present you a simple guide showing how you can create your own icon packs application.

[YOUTUBE]zLV4NU8GjIA[/YOUTUBE]​

Final app created using this guide will be a plug-in to be used in conjunction with my xposed module, Xperia™ Xposed (KK), in which manages and injects chosen icon pack on Xperia™ Z3 stock home launcher (Home.apk) since its version 3.4 (see changelog).

The "Icon Packs" feature present on Xperia™ Xposed (KK) module can inject icon packs from most of known 3rd-party launchers (free and paid ones).

But I wonder, why I do not give users a way of themselves to create their own icon packs? This is the main goal of all this!!

Are you ready? Yep! ... So here we go:

Requirements:

- Exactly the same requirements of the Xperia™ Xposed (KK) module

- Some basic skills on how to decompile and recompile apks

- Being creative

Instructions:

1. Download attached v1.2_SerajrXperiaXposedHomeIconPacks.apk (it will be your template app)

2. Decompile it (it requires no special framework files to be processed with)

3. Open AndroidManifest.xml file (with Notepad++ or another good text file editor) and

change the package name attribute value (in red) to your own one, eg.: my.own.icon.pack (it must be unique):

<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="1" android:versionName="1.0" [B][COLOR="Blue"]package[/COLOR][/B]="[B][COLOR="red"]serajr.xperia.xposed.home.icon.packs[/COLOR][/B]"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="21" />
<supports-screens android:anyDensity="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
<application android:label="@string/app_name" android:icon="@drawable/app_icon" android:debuggable="true" android:allowBackup="true">
<activity android:name="serajr.xperia.xposed.home.icons.pack.MainActivity">
<intent-filter>
<action android:name="com.serajr.xperia.xposed.home.ICONS_PACK" />
</intent-filter>
<meta-data android:name="icons_pack_description" android:value="@string/app_description" />
</activity>
</application>
</manifest>

4. Open strings.xml file (\res\values) and do change the app_name and app_description attributes values (self explanatory)

5. Open app_icon.png file (\res\drawable-xhdpi) with any picture/photo editor and create your own icon (96x96 pixels big)

(optional, but I think you want to have your own icon)

6. Open appfilter.xml file (\res\xml). You will see:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<item [B][COLOR="Blue"]component[/COLOR][/B]="drawer" [B][COLOR="blue"]drawable[/COLOR][/B]="drawer" />
<item [B][COLOR="blue"]component[/COLOR][/B]="folder" [B][COLOR="blue"]drawable[/COLOR][/B]="folder" />
<item [B][COLOR="Blue"]component[/COLOR][/B]="ComponentInfo{com.android.settings/com.android.settings.Settings}" [B][COLOR="blue"]drawable[/COLOR][/B]="settings" />
</resources>

First two items (drawer and folder) are fixed ones, DO NOT REMOVE THEM!

If you don't want to include these on your own icon packs, simple change their drawable attribute values with a empty string:

<item [B][COLOR="Blue"]component[/COLOR][/B]="drawer" [B][COLOR="blue"]drawable[/COLOR][/B]=[B][COLOR="Red"]""[/COLOR][/B] />
<item [B][COLOR="blue"]component[/COLOR][/B]="folder" [B][COLOR="blue"]drawable[/COLOR][/B]=[B][COLOR="red"]""[/COLOR][/B] />

appfilter.xml file is the main link between the apps you want to replace icons for and their new icons (drawables)

Each app is represented by a item (line) inside the file, containing two attributes each, they are:

- component = a formated string in which the app launcher intent component is represented

- drawable = the drawable name for this app inside drawable-xxhdpi folder (144x144 pixels big)

The component attribute value is compound by:

- package name/full path class name

Let's add a new item (line) in appfilter.xml for Calculator app. For that, we need to know its exactly startup intent filter (component) in which it has the info we're looking for.

For that, see 2nd post, or:

A simple way to get it, it's the logcat. Everytime an app is launched, ActivityManager reports its launch intent on logcat, and by launching Calculator app, we get this line reported out:

03-05 11:16:34.222: I/ActivityManager(1250): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=[B][COLOR="red"]com.android.calculator2/.Calculator[/COLOR][/B]} from pid 13733

The info we need is marked in red above, and it is:

[B][COLOR="red"]com.android.calculator2/.Calculator[/COLOR][/B]

Let's now turn the simple class name into a full path class name, by adding the package name just before .Calculator, and we will get:

[B][COLOR="red"]com.android.calculator2/com.android.calculator2.Calculator[/COLOR][/B]

Now we have part of our component attribute, so, the new item (line) will be:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<item [B][COLOR="Blue"]component[/COLOR][/B]="drawer" [B][COLOR="blue"]drawable[/COLOR][/B]="drawer" />
<item [B][COLOR="blue"]component[/COLOR][/B]="folder" [B][COLOR="blue"]drawable[/COLOR][/B]="folder" />
<item [B][COLOR="blue"]component[/COLOR][/B]="ComponentInfo{com.android.settings/com.android.settings.Settings}" [B][COLOR="blue"]drawable[/COLOR][/B]="settings" />

[B]<item [COLOR="Blue"]component[/COLOR]="ComponentInfo{[COLOR="Red"]com.android.calculator2/com.android.calculator2.Calculator[/COLOR]}" [COLOR="blue"]drawable[/COLOR]="[COLOR="Red"]calculator[/COLOR]" />[/B]

</resources>

7. Do the same for each app you want to add in your icon pack.

8. Recompile, sign (very important) and rename your newly created apk!

Do you want it even more simple?

- Download attached v1.2_SerajrXperiaXposedHomeIconPacks_Eclipse_Project.zip

- Import its contents into Eclipse workspace

- Refactor > Rename

- Android Tools > Rename application package

Credits:

- Sony

- Me

- [MENTION=599722]niaboc79[/MENTION]

- AroundLite's creators (for some icons used in the template app)

That's it!

And don't forget to share your icon packs with us!!

Hope you've enjoyed it!! And if so, simple press the "Thanks" button... ;)

.