[GUIDE][MOD] Modify Launcher2 3D for any screen resolution or size UPDATE - 2/12/12
NEWS AND UPDATES
I have continued my research and discovered some better ways to port the launcher. the key update im adding to the guide today is how to fix the icon label aliasing. see step 11
Greetings all XDA friends,
I have been up all night working on this for my Atrix 4g.
I think I have made enough documentation to make an official guide
This guide will teach you how to modify the stock android 3D Launcher to work with any screen size and resolution.
Last night I successfully ported it to QHD screens and posted the source/changes on my github page (https://github.com/gh123man/Launcher2_QHD
Launcher2 has 2 views for the app drawer. A 2D view that works with any phone and is the default as outlined in the source. A 3D view that only works correctly with phones of a 850x480 resolution.
Being I am a lover of the stock android experence I wanted to make this possible on my device.
While I am aware this has been done before on QHD screens, I could not find any source code or documentation on how to make some changes that I wanted to make. This guide should allow you to correct the possition of the 3D app drawer on any device. I am using QHD as an example.
THIS IS LINUX ONLY
IM USING UBUNTU 11.04
1) the first thing you need to do is download the android source code and sdk. why? because the stock launcher can only be compiled with the tools used to build the entire firmware from source. it CANNOT BE COMPILED IN ECLIPSE because some libraries are private and not included in the sdk. so the first step is to set up the build environment. we need the sdk because of adb. I would assume you have it.
follow the guide as outlined here http://source.android.com/source/initializing.html
go to developer.android.com for the sdk
after you have the build environment configured you should download the cyanogenmod 7 source. I decided against the official source from google because cm7 has support for tons of devices and wont compile odexed apks.
so folow this guide http://source.android.com/source/downloading.html
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
so you get cm7 source and not the stock ICS source.
2) long step 1 eh? anyways. once the source is downloaded into a working directory your going to want to compile it for a device. because if we are only going to compile launcher 2 it needs a clean build first. so...
cd into your /working_dir (or whatever you called it) and type these commands
when the big menu comes up pick a device. not full-eng, a real device. I picked the olympus because I work on the atrix anyway. you need to pick a device because it will ensure you get a deodexed apk in your /out directory.
so after lunch I type
...waits a long time
then if all went well
(if it fails change it to -j1)
THIS WILL TAKE A LONG TIME
i have a dual core hyperthreaded i5 laptop. a -j1 build takes about 2 hrs because its only working off one logical core.
be paitent you only need to do this once.
3) let build the launcher on its own to make sure it compiles clean.
this will go much faster.
now you can navigate to
and pull out the Launcher2.apk
4) make sure adb is in your path, if its not and you have the sdk installed this should help
5) make sure you have an alternate launcher installed. most people do now, weather its adw or something that comes with your rom. make sure Launcher2 is not your only launcher on your phone if you even have it.
adb push out/target/product/<device_name>/system/app/Launcher2.apk /system/app
chmod 644 Launcher2.apk
or you can do this all with root explorer. adb is much faster if your doing the whole trial and error methond like I did
6) now that you have the pure unmodded stock launcher on your phone, it should not have 3d turned on. we will fix that next
7) now to jump into some code. first things first your going to want to back up your launcher2 folder in /Packages/apps
just save it anywere in its current state. if you dont its not that big a deal, a repo sync will fix it if its broked too.
and open all_apps.xml in any text editor.
and change this line
<include layout="@layout/all_apps_2d" />
<include layout="@layout/all_apps_3d" />
8) now you have 3d mode enabled compile and push it over again to make sure it runs and your changes took effect. go through steps 3 - 5
it should look something like this if your using a QHD device
9) its time to start resizing it to fit our screen. navigate to
and open AllApps3D.java in any text editor. one that colors the code helps. the stock ubuntu editor does this. go down to around line 280.
This is the magic block of code we are looking for.
now let me shed some light on how this works. it took me a few hours to find this and figure out what it does and how it works. basicly the values in the array tf control the possition, zoom level, and start and end point of the 3d drawer. this is what I came up with using the trial and error method.
if you have any programming experence you know the number has to do with the possiton in the list starting at 0.
tf 6 = vertical streatch of main grid from the bottom
tf 7 = vertical streatch of main grid from the top
tf 8 = zoom level
tf 10 = horizontal shift
tf 11 = vertical shift
tf 6 = 120.f
tf 7 = 680.f
tf 8 = (2.f / 480.f)
tf 10 = -((float)w / 2) - 0.25f
tf 11 = -380.25
that should make it a little easier for anyone to understand.
so what you basicly want to to is change these valuse, compile it, push it, test it, repeat until your figure out what looks best. Dont worry about the icons looking horrible. we are fixing that next.
10) now we need to resize the icons to match your screen resolution. so head to the top-ish of AllApps3D and look for this section around line 149
your looking for this
you mainly want to worry about
ICON_TEXTURE_WIDTH_PX = 74;
ICON_TEXTURE_HEIGHT_PX = 74;
as long as these 2 values are the same the icons will be square. so size them up and down until it looks right. or you can use figure out the ratio to match your resolution perfectly. its up to you. the goal is to make sure that when scrolling the icons do get "ripples" through them.
11) the last step is to fix the icon labels. as you zoom in and out and realign the grid and re-size the icons. The icon labels become distorted. To fix this you need to go to
I want to say .rs stands for render script? someone correct me if im wrong.
Anyways what you need to do is go to line 338ish and find
vpConstants->ImgSize.x = 107.f;
vpConstants->ImgSize.y = 57.f;
your number will look different as these are my settings.
x = the width of the icon label
y = the hight of the icon label
I dont know any easy way to do this other then the old "compile it, push it, test it, repeat" method.
so mess with them until the text is crisp and clear
all changes are updated on my github if you want to use it for reference!
my final product looks like this
If anyone would like more information or the source for QHD just head over to my github.
If you have any questions. let me know. ill do my best to help out.
small update. I fixed texture tearing on QHD. see my github for changes
front page link
just fixing errors and stuff