Are you running a stock 4.4.2 or 4.4.4 Xperia rom? Or even a rom based on stock like MoonWalker or Ultimate PureXZ?
Yes?
Would you like to add a brightness bar to your pull-down screen?
Yes?
Then read on and I'll tell you how to do it!
For this mod, you need to decompile your rom's SystemUI.apk. If you don't know how to do that, I suggest finding out before you go any further.
Have a look at Tickle My Android (tinyurl.com/ticklemyandroid) if you want to use one of the best decompiling tools on the planet..
Once you've decompiled SystemUI.apk, edit res\layout\somc_quick_settings_tab.xml..
Code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.sonymobile.systemui.statusbar.tools.LayoutAnimationView android:orientation="vertical" android:id="@id/quick_settings_tab" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layoutDirection="ltr">
<GridLayout android:id="@id/tools_rows" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/notification_panel_tools_padding_top" android:animateLayoutChanges="true" />
<View android:id="@id/divider" android:background="@android:drawable/divider_horizontal_dark" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="1.0dip" />
<HorizontalScrollView android:scrollbarStyle="insideOverlay" android:id="@id/unused_tools_scroll_view" android:background="@drawable/somc_quick_settings_edit" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="@dimen/unused_tools_minimum_height">
<GridLayout android:id="@id/unused_tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="@dimen/unused_tools_minimum_height" android:animateLayoutChanges="true" android:rowCount="1" />
</HorizontalScrollView>
<View android:id="@id/divider_bottom" android:background="@drawable/somc_statusbar_edit_close" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="1.0dip" />
</com.sonymobile.systemui.statusbar.tools.LayoutAnimationView>
</FrameLayout>
Code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.sonymobile.systemui.statusbar.tools.LayoutAnimationView android:orientation="vertical" android:id="@id/quick_settings_tab" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layoutDirection="ltr">
[COLOR="Red"][b] <include android:layout_width="fill_parent" android:layout_height="wrap_content" layout="@layout/ticklefish_brightness_dialog" />[/COLOR][/b]
<GridLayout android:id="@id/tools_rows" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/notification_panel_tools_padding_top" android:animateLayoutChanges="true" />
<View android:id="@id/divider" android:background="@android:drawable/divider_horizontal_dark" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="1.0dip" />
<HorizontalScrollView android:scrollbarStyle="insideOverlay" android:id="@id/unused_tools_scroll_view" android:background="@drawable/somc_quick_settings_edit" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="@dimen/unused_tools_minimum_height">
<GridLayout android:id="@id/unused_tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="@dimen/unused_tools_minimum_height" android:animateLayoutChanges="true" android:rowCount="1" />
</HorizontalScrollView>
<View android:id="@id/divider_bottom" android:background="@drawable/somc_statusbar_edit_close" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="1.0dip" />
</com.sonymobile.systemui.statusbar.tools.LayoutAnimationView>
</FrameLayout>
Now edit smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali.
After the last .field line, insert the line in red..
Code:
.field private mUserSetupObserver:Landroid/database/ContentObserver;
[b][COLOR="Red"].field private mBrightnessController:Lcom/android/systemui/settings/BrightnessController;[/COLOR][/b]
Code:
[B][COLOR="Red"]# direct methods
.method private setUpBrightnessSlider()V
.locals 4
.prologue
.line 196
iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanel:Lcom/android/systemui/statusbar/phone/NotificationPanelView;
const v0, [COLOR="DeepSkyBlue"]0x7f08004c[/COLOR]
invoke-virtual {v2, v0}, Lcom/android/systemui/statusbar/phone/NotificationPanelView;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
const v1, [COLOR="SeaGreen"]0x7f08004d[/COLOR]
invoke-virtual {v2, v1}, Lcom/android/systemui/statusbar/phone/NotificationPanelView;->findViewById(I)Landroid/view/View;
move-result-object v1
check-cast v1, Lcom/android/systemui/settings/ToggleSlider;
new-instance v2, Lcom/android/systemui/settings/BrightnessController;
iget-object v3, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-direct {v2, v3, v0, v1}, Lcom/android/systemui/settings/BrightnessController;-><init>(Landroid/content/Context;Landroid/widget/ImageView;Lcom/android/systemui/settings/ToggleSlider;)V
.line 199
iput-object v2, p0, Lcom/android/systemui/settings/BrightnessDialog;->mBrightnessController:Lcom/android/systemui/settings/BrightnessController;
.line 201
return-void
.end method[/COLOR][/B]
Then look up the reference for brightness_slider and replace 0x7f08004d with it in the code above.
Finally, find this code in your smali:
Code:
const-string v0, "com.sonymobile.notes.NEW_SKETCH"
invoke-direct {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->isAppInstalled(Ljava/lang/String;)Z
move-result v0
iput-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mRightVisible:Z
Code:
const-string v0, "com.sonymobile.notes.NEW_SKETCH"
invoke-direct {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->isAppInstalled(Ljava/lang/String;)Z
move-result v0
iput-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mRightVisible:Z
[b][COLOR="Red"]invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setUpBrightnessSlider()V[/COLOR][/b]
Save everything, recompile and flash back to your phone, wait for everything to load and...there's your brightness bar!
(Please note, this is meant for stock Xperia 4.4.2 and 4.4.4 roms only. If you have something else, this mod probably won't work for you. And please don't ask me to make it work.)
Credits for this mod entirely go to The Master, @serajr, for his help with the smali. Get well soon, my friend! :good:
Attachments
-
656 bytes Views: 292
Last edited: