[GUIDE] How to change the number of stock launcher screens of JB ROM [Launcher2.apk]

wesamothman

Recognized Contributor
Apr 5, 2012
6,521
26,692
0
Dallas - TX
Hello guys,

I received quite some messages / requests to write a guide on how to change the number of screens of JB ROM for team EOS by modifying the launcher2.apk;
So, I decided to share with you what I did with thanks go first to runandhide05 for his valuable help...

This guide is not only applicable to EOS ROM, but also to any JB ROM for XOOM and other devices with /system/app/launcher2.apk.


Tools Required:

GUIDE:

1) grap /system/app/launcher2.apk: To be modded.
2) grap /system/framework/framework-res.apk: Needed for apktool environment
3) download apktool and extract it. Say: C:/
4) open command line, cmd, and navigate to where you extracted apktool
5) place framework-res.apk in the apktool folder where it was extracted.
6) install the framework-res.apk by typing: apktool if framework-res.apk
7) place the launcher2.apk in the apktool folder where it was extracted.
7) decompile launcher2.apk by typing: apktool d Launcher2.apk
8) after successful decompilation, the output folder will be :\were\extracted\zip\is\Launcher2\
9) Make the below changes:

Here are the files you need to modifiy:

res/layout-port/launcher.xml
res/layout-land/launcher.xml
res/layout-sw720dp/workspace.xml
res/values/public.xml
res/values/ids.xml

To decrease the number of screens; example from 5 to 3:
- change launcher:defaultScreen="2" to launcher:defaultScreen="1" where 1 is the middle screen of the 3 screens. numbers convension are 0,1,2.

- From:
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
<include android:id="@id/cell3" layout="@layout/workspace_screen" />
<include android:id="@id/cell4" layout="@layout/workspace_screen" />
<include android:id="@id/cell5" layout="@layout/workspace_screen" />

- To:
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
<include android:id="@id/cell3" layout="@layout/workspace_screen" />

- And public.xml in res/values in which I had to delete

<public type="id" name="cell4" id="hex val xxxxx" />
<public type="id" name="cell5" id="hex val xxxxx" />


To increase the number of screens; example from 5 to 7
- change launcher:defaultScreen="2" to launcher:defaultScreen="2" where 3 is the middle screen of the 7 screens. numbers convension are 0,1,2,3,4,5,6

- From:
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
<include android:id="@id/cell3" layout="@layout/workspace_screen" />
<include android:id="@id/cell4" layout="@layout/workspace_screen" />
<include android:id="@id/cell5" layout="@layout/workspace_screen" />

- To:
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
<include android:id="@id/cell3" layout="@layout/workspace_screen" />
<include android:id="@id/cell4" layout="@layout/workspace_screen" />
<include android:id="@id/cell5" layout="@layout/workspace_screen" />
<include android:id="@id/cell6" layout="@layout/workspace_screen" />
<include android:id="@id/cell7" layout="@layout/workspace_screen" />

- And public.xml in res/values in which I had to add

<public type="id" name="cell6" id="hex val xxxxx" />
<public type="id" name="cell7" id="hex val xxxxx" />

xxx is the hex code for the vale id. You have to make sure that this code is unique and it is not present anywhere. You cannot use an existing value. So, to make it easy,
you open the pulic.xml file and check the last code used; increment by 1 for each added configuration; example: if the last hex code used in the file is 0x7f0d0017, you use 0x7f0d0018 and 0x7f0d0019
Hex codes are from 0 -- F [0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f] if the last digit of the code is 9 and you want to increase, then 9 + 1 = a;

- Note: ids.xml
if you are adding more screens, then in ids.xml you have to add instances.

<item type="id" name="cell6">false</item>
<item type="id" name="cell7">false</item>

if you are decreasing the number of screens, no need to add, just keep them 5, they are false anyway.

10) compile the apk: in cmd type
apktool b Launcher2
11) now navigate to :\were\extracted\zip\is\Launcher2\build\apk\
12) copy the original Launcher2.apk from :\were\extracted\zip\is\ to :\were\extracted\zip\is\Launcher2\build\apk\
13) OPEN not extract the apk with 7zip
14) and now click and highlight from the :\were\extracted\zip\is\Launcher2\build\apk\ the res folder the classes.dex file and the resouces.arsc and drag them into the root of the Launcher2.apk that is open in 7zip
15) close 7zip and the file is now ready to be pushed / flashed in device.

Attached is a ready flashable script that can be used to flash your modded file through recovery.

Installation:
1) download the sample flashable zip
2) extract it and put your modded launcher2.apk in \system\app\
3) rezip
4) put your flashable zip in SD CARD.
5) boot into recovery and flash it.
6) reboot.

I have made stock launcher screens ready (1,3,5,7,9 screens) ready in here:
http://forum.xda-developers.com/showthread.php?t=1836783

ENJOY :)
 
Last edited:
  • Like
Reactions: EGY_STARS