[TUT] [ACID] How to create overscroll (advanced)
All credit for how this works goes to the following poster dhiru1602 - http://forum.xda-developers.com/show....php?t=1027935
I wanted to learn how to do my own custom overscroll (color etc.) for a theme I'm building. Anyhow, it turns out to not be so complicated if you know what you are doing and are a developer. This is mostly for any devs out there that want to include overscroll in their Gingerbread themes.
TEAM ACID gives back. Please give credit where credit is do, and if this helps ya, feel free to thank us.
PROCEED AT YOUR OWN RISK. I AM NOT RESPONSIBLE FOR BOOTLOOPS, BRICKS, MAD WIFE'S AND/OR GF'S, LOST TIME ETC. lol xD. ALSO OVERSCROLL ONLY WORKS FOR GINGERBREAD ROMS
1. Get the framework.jar file from your /system/framework/ folder
- Make a backup of this file in case you screw up, and need to push it back onto your device, to resolve bootloops etc. (NOTE: I literally just dev'ed this up by following the different directions and had no issues)
2. Open up framework.jar on your computer via WinRAR (is what I used) whatever archive program should work.
3. Copy the classes.dex file from the framework out into your directory
4. Use baksmali to extract the smali files from the classes.dex file (See Required Tools below)
5. Command Syntax:
java -jar baksmali-1.2.6.jar -o <output directory> <.dex file, typically classes.dex>
6. Inside of the output directory you will find /android/widget.
7. Download the following zip (Overscroll_source zip etc. see attached files) and extract the files from it and copy them into that widget folder overriding the existing files (Again credit goes to dhiru1602 for these files)
8. Once the files are in there you are going to need to do some work to get the resource ID's for the png's in the framework-res.apk so you can link them up with the smali files.
9. Get framework-res.apk from /system/framework and decompile it with apktool or apkmanager and modify the following file. You need to open up the /res/values/public.xml. Do a search for "overscroll_edge"
10. You will find two items "overscroll_edge" and "overscroll_glow" along with resource ID's as an attribute on those tags. Make note of those Resource ID's, I just put them in a txt file to remember them.
11. Back over to framework.jar work. You will now need to open up /android/widget/AbsListView.smali
12. Search for inside the file "setOverScrollMode" and modify the following lines:
The first is edge, second is glow.
.local v2, res:Landroid/content/res/Resources;
const v3, 0x01080261 <---- Resource ID you noted from framework-res
.local v0, edge:Landroid/graphics/drawable/Drawable;
const v3, 0x01080262 <---- Resource ID you noted from framework-res
Put the resource ID's into those areas and save the file.
13. Now you need to re-dex the file by running the following command
java -jar smali-1.2.6.jar <output directory you made> -o <name of the dex file, I used classes.dex >
14. Open up the original framework.jar via WinRAR etc. that you took the classes.dex file from. Now drop the classes.dex file back into the framework.jar so that it replaces what is in there. Close WinRAR etc.
15. Push the framework.jar back onto your device. I used
adb push framework.jar /system/framework/
After mounting the /system directory first.
Don't use a file manager, you really don't wanna get FC's and stuff.
16. Immediately after pushing the file, adb reboot etc.
This is just for testing, obviously you would make sure this is part of a flashable zip when releasing as opposed to requiring it to be pushed while the system is running.
Again I encountered no issues with bootloops etc.
- Baksmali (extracts) and Smali (compiles back to .dex)
- Java SDK to run jar files
- Files required: framework.jar and framework-res.apk
- Notepad is what I use to edit.