Defy+ CM9 On-screen button

Does it work?

  • Yes

    Votes: 45 90.0%
  • No

    Votes: 5 10.0%

  • Total voters
    50

Nchls

Senior Member
Jan 17, 2012
215
58
0
Singapore
Nchls,
i made a step-by-step tutorial to create this mod.. :)

So everyone in here could make it for themself,
and make your job easier, to not to create every builds requested :)

If you want, you could quote this to the 1st post.

-----------------------------------------------
Make sure you have JRE installed on your system
Download and install JRE first
* Download JRE 64 bit for 64 bit system *

- Get your original framework-res.apk file from /system/framework/framework-res.apk
- Use adb pull, or just simply take it from inside ROM's zip

- Download the attachment, or this link (APKTool) (use this APKTool, some APKTools version cannot re-compile)
- Extract APKTool.zip
- In Windows Explorer, press hold Shift and right click APKTool folder
- Choose "Open command window here"
- In command prompt window, type:
apktool d framework-res.apk framework-res-edit
- APK is now decompiled, so now you can edit something, like changing the images or editing XMLs.
- Decompiled APK is on folder "framework-res-edit"
- Go to folder \framework-res-edit\res\values
- There's two file should be edited, bools.xml and dimens.xml

- For bools.xml, find this line, and change it to true, then save.
<bool name="config_showNavigationBar">true</bool>

- For dimens.xml, find this line, and change it to 36 (36 of height, so won't take much space), save.
<dimen name="navigation_bar_height">36.0dip</dimen>

- Back to the command prompt and then type:
apktool b framework-res-edit
- Just wait, it would take a minutes.. and now APK is re-compiled

if anything goes right, it should be like this screenshot:


ps:
on decompile and re-compile command i'm using "framework-edit-res" as an example of folder name,
you could use another folder name, it's your choice.

IMPORTANT..!!
In this case (editing a framework),
just DO NOT USE a recompiled APK on \framework-res-edit\dist
Use manual method, instead.
Because "resources.arsc" file inside the framework APK should not be compressed at all,
otherwise, you'll get bootloop.
resources.arsc should ONLY be "stored" on archive file, not "compressed".
So, here we go..

- Rename the ORIGINAL framework-res.apk to framework-res.zip
- OPEN it with 7zip or WinRAR, just let the window stay opened
- Go to folder \framework-res-edit\build\apk then delete AndroidManifest.xml file
- Drag "res" folder into 7zip / WinRAR window, so the res folder is now updated
- Drag resources.arsc file into 7zip / WinRAR window, BUT set the compression as "STORE" only
- Now all the files on original framework-res should be updated with the edited one
- Rename framework-res.zip to framework-res.apk.

- You are good to go, use that new framework in your system.
- Use adb push or create update zip to put it on your rom, your choice.. :)
- Make sure wipe cache + wipe dalvik cache after that.
-----------------------------------------------
Good job dude! Really good tutorial you've got here! : ) Thanks, and added to op. Its useful to me too, as I'm having my major exam this year.
 
Last edited:
  • Like
Reactions: marhensa

jassi32

Senior Member
Sep 24, 2011
371
190
0
INDIA
thanks it works ,

i got a problem , when i set nav bar to 4 , the extreme right works sometimes , like i had to tap 2-3 times , unto the symbol only , else it doesn't work ,
is it normal ?
 
  • Like
Reactions: hadi447

marhensa

Senior Member
Dec 17, 2010
2,017
1,174
0
Bogor
thanks it works ,

i got a problem , when i set nav bar to 4 , the extreme right works sometimes , like i had to tap 2-3 times , unto the symbol only , else it doesn't work ,
is it normal ?
i only have issues on multitasking button, which list of previous app will show about 1 sec after button pressed..
ram management problem maybe..

Sent from TapaTalk | MotoDEFY - Android Jelly Bean 4.1.1
 
  • Like
Reactions: hadi447

hadi447

Member
Dec 28, 2011
17
0
0
www.facebook.com
Hey guys, I finally managed to get it to work! I've done the editting of the framework-res.apk and finally got the on-screen button to work! :D


After you downloaded the file, unzip it and use adb and push it into your system/framework.res

Or:
Unzip it and put it into the flashable zip, system/framework. Then flash it via CMW.


NOTE: To disable the capacitive buttons, download the four file from the link and copy paste it into your system/usr/keylayout.
*remember to back up the 4 original files before replacing it!
Credit to " adamo3957 " for telling me this!
http://www.mediafire.com/?jzcpylhc0996xa4
http://www.mediafire.com/?iuuinn9t0m1vrww
http://www.mediafire.com/?2uw2z7oubw9it2l
http://www.mediafire.com/?7aivvw3acd25rl7

Sorry I had to upload to mediafire, because my PC is not working..

Alternate Link: http://db.tt/h8Bd1nIZ




*Awesome tutorial from marhensa


Updates:
Added: Flashable Zip for those who don't know how to use ADB
Added: (090712 Quarx Defy+/ GB kernel build) On Screen Button
Added: (100712 Quarx Defy+/ GB kernel build) On Screen Button
Added: (110712 Epsylon Defy/ Froyo kernel build) On Screen Button

;)

DEFY+

Some Requests:
-Enable + Revert ( Epsylon 11072012 Defy Build):
https://www.dropbox.com/s/ix0f5nhk71y7s5b/(Multi) Epsylon 11072012 Defy Build.rar

-Enable + Revert ( Quarx 10072012 Defy+ Build):
https://www.dropbox.com/s/no864wps6s5zpyn/(Multi) Quarx 10072012 Defy+ Build.rar

*Download according to your model! Don't download the wrong ones, as I have added a Epsylon DEFY Build (11072012)!
I have moto defy green lens .
which i should download?:confused:
 

m11kkaa

Recognized Developer / Inactive Recognized Contrib
Jan 20, 2011
1,259
2,145
0
I have created an shell-script which automates the process of patching framework-res.apk. Please don't ask for an windows-version.
Source/Download: https://github.com/M1cha/android_onscreenbutton_enabler
Usage: ./patch-framework.sh framework-res.apk [navigation_bar_height]

I've tested this successfully with latest CM10-build(normal defy).
BTW: In CM10 longpressing the HomeButton at the NavBar has a new function :)
 
Last edited:
  • Like
Reactions: marhensa

marhensa

Senior Member
Dec 17, 2010
2,017
1,174
0
Bogor
I have created an shell-script which automates the process of patching framework-res.apk. Please don't ask for an windows-version.
Source/Download: https://github.com/M1cha/android_onscreenbutton_enabler
Usage: ./patch-framework.sh framework-res.apk [navigation_bar_height]

I've tested this successfully with latest CM10-build(normal defy).
BTW: In CM10 longpressing the HomeButton at the NavBar has a new function :)
okay, thank you so much..

i will install ubuntu on virtual system for it.

but, how to load / run the script? sorry dumb question.
i'm no linux guy.. :)

Sent from TapaTalk | MotoDEFY - Android Jelly Bean 4.1.1
 

marhensa

Senior Member
Dec 17, 2010
2,017
1,174
0
Bogor
:confused:Can i use this on my s5360 ???
Sent from my GT-S5360
the method is same..
just make your custom for your phone framework-res.apk

as long as it is CM9 / CM 10 / AOSP ICS / AOSP JB.

if you downloading and use framework from defy from 1st post for your phone, surely it wont work.


see my tutorial earlier i wrote..
or try the script m11kkaa create to do it the easy way.

Sent from TapaTalk | MotoDEFY - Android Jelly Bean 4.1.1
 
Last edited:

m11kkaa

Recognized Developer / Inactive Recognized Contrib
Jan 20, 2011
1,259
2,145
0
okay, thank you so much..

i will install ubuntu on virtual system for it.

but, how to load / run the script? sorry dumb question.
i'm no linux guy.. :)

Sent from TapaTalk | MotoDEFY - Android Jelly Bean 4.1.1
Just download the package and extract it: https://github.com/M1cha/android_onscreenbutton_enabler/zipball/master

Then open an terminal(CTRL+ALT+T).
then navigate to the extraction-directory inside the terminal(command "cd", read a shell tutorial).

The last step is easy:
./patch-framework.sh framework-res.apk [navigation_bar_height]
for example:
./patch-framework.sh framework-res.apk 36.0dip
 
  • Like
Reactions: marhensa

marhensa

Senior Member
Dec 17, 2010
2,017
1,174
0
Bogor
Just download the package and extract it: https://github.com/M1cha/android_onscreenbutton_enabler/zipball/master

Then open an terminal(CTRL+ALT+T).
then navigate to the extraction-directory inside the terminal(command "cd", read a shell tutorial).

The last step is easy:
./patch-framework.sh framework-res.apk [navigation_bar_height]
for example:
./patch-framework.sh framework-res.apk 36.0dip
awesome, man..
plain awesome..
hope it works with live cd of ubuntu..

many thanks.. :)

your script should be promoted to XDA portal news.
promoting now..!! :D

Sent from TapaTalk | MotoDEFY - Android Jelly Bean 4.1.1
 

m11kkaa

Recognized Developer / Inactive Recognized Contrib
Jan 20, 2011
1,259
2,145
0
Hey guys. We don't longer need to modify the framework to enable the Navigationbar - there is another way :)

Just add the following line to the file /system/build.prop(or change it's value if its already exists):
Code:
qemu.hw.mainkeys=0
You can enable/disable the NavBar tempoary by executing the following commands in adb(this will raise a HotReboot):
Code:
setprop qemu.hw.mainkeys [B]0[/B]
killall system_server
0=enable
1=disable
 

marhensa

Senior Member
Dec 17, 2010
2,017
1,174
0
Bogor
Hey guys. We don't longer need to modify the framework to enable the Navigationbar - there is another way :)

Just add the following line to the file /system/build.prop(or change it's value if its already exists):
Code:
qemu.hw.mainkeys=0
You can enable/disable the NavBar tempoary by executing the following commands in adb(this will raise a HotReboot):
Code:
setprop qemu.hw.mainkeys [B]0[/B]
killall system_server
0=enable
1=disable
haha..
is it for another aosp rom in another device too?

Sent from TapaTalk | MotoDEFY - Android Jelly Bean 4.1.1
 

m11kkaa

Recognized Developer / Inactive Recognized Contrib
Jan 20, 2011
1,259
2,145
0
Just try it. this is the sourcecode which checks if the navbar will be enabled:
PHP:
// SystemUI (status bar) layout policy
int shortSizeDp = shortSize
	* DisplayMetrics.DENSITY_DEFAULT
	/ DisplayMetrics.DENSITY_DEVICE;

if (shortSizeDp < 600) {
    // 0-599dp: "phone" UI with a separate status & navigation bar
    mHasSystemNavBar = false;
    mNavigationBarCanMove = true;
} else if (shortSizeDp < 720) {
    // 600-719dp: "phone" UI with modifications for larger screens
    mHasSystemNavBar = false;
    mNavigationBarCanMove = false;
} else {
    // 720dp: "tablet" UI with a single combined status & navigation bar
    mHasSystemNavBar = true;
    mNavigationBarCanMove = false;
}

if (!mHasSystemNavBar) {
    mHasNavigationBar = mContext.getResources().getBoolean(
	    com.android.internal.R.bool.config_showNavigationBar);
    // Allow a system property to override this. Used by the emulator.
    // See also hasNavigationBar().
    String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
    if (! "".equals(navBarOverride)) {
	if      (navBarOverride.equals("1")) mHasNavigationBar = false;
	else if (navBarOverride.equals("0")) mHasNavigationBar = true;
    }
} else {
    mHasNavigationBar = false;
}
You can find this code in the file "frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java"
You still need to modify the framework if you want to change the height of the NavBar.
 
Last edited:

sebx_g1

Senior Member
Nov 6, 2009
2,912
707
193
Yeah, quite big buttons it produce :what:
I'll try do change screen dpi a bit.

Wysyłane z mojego MB525 za pomocą Tapatalk 2