[Xperia Z Themes and Apps] flintston314:
Hi,

I was quite annoyed by the fact that noone made a Navbar with 4 softkeys instead of the default 3 (at least I couldn´t find any - specially not for 4.2.2).

I do use the menu key quite often and it is quite a hassle for me using menu keys on the top (with such a huge device).

Anyway, here you go: 4 Button Navigation Bar, Black (no idea how to get transparent - tell me if you know how and I will add it). Please note that I am using a 32dpi Navbar, so its smaller (using this MOD should not affect you Navigation Bar size - if it should download another dpi size http://xdaforums.com/showthread.php?t=2171768&page=22 )

If you are using stock 4.2.2 Launcher with the semi-transparent Navbar....those will stay transparent. The screenshots posted use another launcher with black Top and Navbars.

Installation via CWM or TWRP!

DOWNLOAD files below!

Guide:

It is actually quite easy to change this, only 2 Files need to be modded:

1st decompile SystemUI.apk (using Tickle my Adroid is probably the easiest Tool to de- and recompile apps).

2. Now navigate to SystemUI\smali\com\android\systemui\statusbar\phone\NavigationBarView.smali

Find the followin method: .method public setDisabledFlags(IZ)V

Now, right below tthis line should be something like

.locals 10

As we add a variable we need to raise that number by 1, so change

.locals x

to

.locals x+1

in my case I had to change it to

.locals 11

Still within this .method, find the line

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getHomeButton()Landroid/view/View;

below that line should be

move-result-object v9

Now add

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getMenuButton()Landroid/view/View;

move-result-object v10

The result should look something like this - once again, the

move-result-object [B]v10[/B]

results from us addind a new var, so if that line before had v7 you would have to add v8, in my case it was v9, so I added v10.

A few lines below you will find

invoke-virtual {v9, v6}, Landroid/view/View;->setVisibility(I)V

right below add the same content and change v9 (or whatever number it is for you) and increment it by 1, so v9 would be v10, resulting in this:

invoke-virtual {v9, v6}, Landroid/view/View;->setVisibility(I)V

[B] invoke-virtual {v10, v6}, Landroid/view/View;->setVisibility(I)V[/B]

(Bold = New line added)

Thats more or less how this should look afterwards (numbers asides)

.line 261
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getHomeButton()Landroid/view/View;

move-result-object v9

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getMenuButton()Landroid/view/View;

move-result-object v10

if-eqz v1, :cond_9

move v6, v8

:goto_8
invoke-virtual {v9, v6}, Landroid/view/View;->setVisibility(I)V

invoke-virtual {v10, v6}, Landroid/view/View;->setVisibility(I)V

.line 262
invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getRecentsButton()Landroid/view/View;

3. Now find

.method public setMenuVisibility(Z)V

and

.method public setMenuVisibility(ZZ)V

Pretty much delete everything, the result should look like this.

.method public setMenuVisibility(Z)V
.locals 1
.parameter "show"

return-void
.end method

.method public setMenuVisibility(ZZ)V
.locals 2
.parameter "show"
.parameter "force"

return-void
.end method

Save and close the file.

4. Open SystemUI/res/layout/navigation_bar.xml to add the button to the xml

I will just paste the conent of this file right below, you will notice the changes. What I basically did was to reformat the buttons and add menu buttons.

The lines startin with

<view ....

are only there for formatting reasons....you can change the value within

android:layout_width= and android:layout_height=

to dip values instead (0.0 meaning no gap). Just experiment with those....the worst that will happen is, that you have no navbar at all....so nothing to worry.

This is how the result of mine looks:

<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.NavigationBarView android:background="@color/system_ui_opaque_background" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layoutDirection="ltr"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
<FrameLayout android:id="@id/rot0" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:orientation="horizontal" android:id="@id/nav_buttons" android:clipChildren="false" android:clipToPadding="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:animateLayoutChanges="true">
<View android:visibility="invisible" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="0.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:layout_width="70.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_back" android:layout_weight="0.0" android:contentDescription="@string/accessibility_back" systemui:keyCode="4" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/home" android:layout_width="70.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_home" android:layout_weight="0.0" android:contentDescription="@string/accessibility_home" systemui:keyCode="3" systemui:keyRepeat="false" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/recent_apps" android:layout_width="70.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:layout_weight="0.0" android:contentDescription="@string/accessibility_recent" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/menu" android:layout_width="70.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_menu" android:layout_weight="0.0" android:contentDescription="@string/accessibility_menu" systemui:keyCode="82" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
</LinearLayout>
<LinearLayout android:orientation="horizontal" android:id="@id/lights_out" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
<View android:visibility="invisible" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="70.0dip" android:layout_height="fill_parent" android:layout_marginLeft="0.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="70.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="70.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="70.0dip" android:layout_height="fill_parent" android:layout_marginRight="0.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0.0" />
</LinearLayout>
<com.android.systemui.statusbar.policy.KeyButtonView android:layout_gravity="center_horizontal" android:id="@id/search_light" android:visibility="gone" android:layout_width="80.0dip" android:layout_height="fill_parent" android:src="@drawable/search_light" android:scaleType="center" />
<com.android.systemui.statusbar.policy.DeadZone android:layout_gravity="top" android:id="@id/deadzone" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:minSize="@dimen/navigation_bar_deadzone_size" systemui:maxSize="@dimen/navigation_bar_deadzone_size_max" systemui:holdTime="@integer/navigation_bar_deadzone_hold" systemui:decayTime="@integer/navigation_bar_deadzone_decay" systemui:orientation="horizontal" />
</FrameLayout>
<FrameLayout android:id="@id/rot90" android:paddingTop="0.0dip" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical" android:id="@id/nav_buttons" android:clipChildren="false" android:clipToPadding="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:animateLayoutChanges="true">
<View android:visibility="invisible" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/menu" android:layout_width="fill_parent" android:layout_height="70.0dip" android:src="@drawable/ic_sysbar_menu_land" android:layout_weight="0.0" android:contentDescription="@string/accessibility_menu" systemui:keyCode="82" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/recent_apps" android:layout_width="fill_parent" android:layout_height="70.0dip" android:src="@drawable/ic_sysbar_recent_land" android:layout_weight="0.0" android:contentDescription="@string/accessibility_recent" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/home" android:layout_width="fill_parent" android:layout_height="70.0dip" android:src="@drawable/ic_sysbar_home_land" android:layout_weight="0.0" android:contentDescription="@string/accessibility_home" systemui:keyCode="3" systemui:keyRepeat="false" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:layout_width="fill_parent" android:layout_height="70.0dip" android:src="@drawable/ic_sysbar_back_land" android:layout_weight="0.0" android:contentDescription="@string/accessibility_back" systemui:keyCode="4" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
</LinearLayout>
<LinearLayout android:orientation="vertical" android:id="@id/lights_out" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent" android:layout_height="70.0dip" android:layout_marginTop="0.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="fill_parent" android:layout_height="70.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="fill_parent" android:layout_height="70.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="fill_parent" android:layout_height="70.0dip" android:layout_marginBottom="0.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0.0" />
</LinearLayout>
<com.android.systemui.statusbar.policy.KeyButtonView android:layout_gravity="center_vertical" android:id="@id/search_light" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="80.0dip" android:src="@drawable/search_light" android:scaleType="center" />
<com.android.systemui.statusbar.policy.DeadZone android:layout_gravity="top" android:id="@id/deadzone" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:minSize="@dimen/navigation_bar_deadzone_size" systemui:maxSize="@dimen/navigation_bar_deadzone_size_max" systemui:holdTime="@integer/navigation_bar_deadzone_hold" systemui:decayTime="@integer/navigation_bar_deadzone_decay" systemui:orientation="vertical" />
</FrameLayout>
<View android:id="@id/rot270" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" />
</com.android.systemui.statusbar.phone.NavigationBarView>

You´re done, recompile SystemUI.apk, prepare it, add it to zip and flash it via CWM/TWRP

Special Thanks to XperienceD for the .244 Version