[GUIDE] [CM11] How To Add Visible Brightness Slider To Status Bar For CM11

TheFixItMan

Senior Member
Jul 8, 2012
7,673
3,934
253
London
How To Add Visible Brightness Slider To Status Bar For CM11

This Guide Is For CM11 Only - For GB/CM7/CM9 See My Guide Here



What Does This Mod Do?
This mod will give you a visible brightness slider on your status bar
Yes we all know you can enable an invisible slider and swipe across the status bar or click the brightness tile to bring up a slider but this mod is specifically for those who want a visible brightness slider on the status bar itself






1 - Download the attachment CM11Brightness at the end of this thread

2 - Decompile SystemUI.apk with apktool (Guide in my signature if you need one)

3 - Place the files from the CM11Brightness.zip at the following locations

smali\com\android\systemui\statusbar
SlideBrightness.smali
SlideBrightness$1.smali
SlideBrightness$2.smali

res\layout
marcus_brightness.xml


4 - Open res/layout/status_bar_expanded.xml with notepad++

5 - Under
Code:
<ViewStub android:id="@id/ribbon_settings_stub" android:layout="@layout/ribbon_settings" android:layout_width="fill_parent" android:layout_height="@dimen/notification_min_height" />
Place
Code:
<include android:id="@id/brightness_slider" layout="@layout/marcus_brightness" />

6 - Recompile

7 - Optional step - sign with a platform key with zipsigner (playstore)

8 - Put in a flashable zip and flash in cwm with system mounted
 

Attachments

Last edited:

(°_o)

Senior Member
Jun 23, 2014
177
161
0
Just in case if anyone comes here, tired of pulling down quick settings, tapping brightness, and sliding but just want the functionality.

You can go to Settings > Interface > Status bar and enable the Status bar brightness control
The option won't be available if you have enabled Automatic brightness though.

Then you can just hold the status bar and slide through to increase, decrease brightness.

If other AOSP based roms are missing this awesome feature you can also get it with Gravity box and Xposed. =)
 

TheFixItMan

Senior Member
Jul 8, 2012
7,673
3,934
253
London
Just in case if anyone comes here, tired of pulling down quick settings, tapping brightness, and sliding but just want the functionality.

You can go to Settings > Interface > Status bar and enable the Status bar brightness control
The option won't be available if you have enabled Automatic brightness though.

Then you can just hold the status bar and slide through to increase, decrease brightness.

If other AOSP based roms are missing this awesome feature you can also get it with Gravity box and Xposed. =)
Please read the op fully!!

What you have described is an invisible brightness slider!

This thread is for a visible brightness slider on the status bar itself - please look at the screenshot


What you have discribed and what this thread is for is totally different!!
 

(°_o)

Senior Member
Jun 23, 2014
177
161
0
Please read the op fully!!

What you have described is an invisible brightness slider!

This thread is for a visible brightness slider on the status bar itself - please look at the screenshot


What you have discribed and what this thread is for is totally different!!
is there any chance of putting the visible brightness bar between the the clock and the icon??
beside the ocassional notifcations clear and loooong date (which i have shorten) that space is pretty much wasted :|
 

TheFixItMan

Senior Member
Jul 8, 2012
7,673
3,934
253
London
is there any chance of putting the visible brightness bar between the the clock and the icon??
beside the ocassional notifcations clear and loooong date (which i have shorten) that space is pretty much wasted :|
Maybe - you would have to place the line for include layout in status_bar_expanded_header.xml instead

I'll do some testing over the next few days when I get time or you can just try moving the include layout code yourself


Update - I couldnt find a layout that didnt cause a force close and I dont want to spend ages looking for a way - Feel free to try out different layouts and if you find one you like let me know and i'll add it to the op
 
Last edited:

slavehunter105

Senior Member
Nov 4, 2012
141
16
38
Dubai, UAE
Just in case if anyone comes here, tired of pulling down quick settings, tapping brightness, and sliding but just want the functionality.

You can go to Settings > Interface > Status bar and enable the Status bar brightness control
The option won't be available if you have enabled Automatic brightness though.

Then you can just hold the status bar and slide through to increase, decrease brightness.

If other AOSP based roms are missing this awesome feature you can also get it with Gravity box and Xposed. =)
u really need to READ properly what he said, he even showed the picture for that too..
 

TheFixItMan

Senior Member
Jul 8, 2012
7,673
3,934
253
London
Would be good to know if this works on non samsung phones too - Anyone with a htc lg or sony etc wanna try it and let me know
 
Last edited:

TheFixItMan

Senior Member
Jul 8, 2012
7,673
3,934
253
London
It's perfect but I think would be awesome if it include automatic brightnes

sent from my i9192 with CM11 by sekil
I have got the smali for that however because my phone doesnt support that feature (hasnt got a light sensor) I didnt include it because I cant test it

If you want to have a go yourself -

You can find all the orig brightness slider files
http://forum.xda-developers.com/attachment.php?attachmentid=2695638&d=1397898301

The xml that you need to include is quickpanel_brightness_settings.xml for the automatic brightness check box with the smali being BrightnessSettingsView
you will need to add some ids and drawable xml/png too

you will find the orig gingerbread guide by evanlocked on my gb/cm7/cm9 guide at the top of this thread which may help
 
Last edited:

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
Would be good to know if this works on non samsung phones too - Anyone with a htc lg or sony etc wanna try it and let me know
Trying it now on my Sony Xperia Z with stock 4.4.3.

I know this is for CM11 but, in theory, it should work on ordinary KK. If not, I'll run a logcat and let you know.

And if it does work, I'll also let you know! :D
 
  • Like
Reactions: TheFixItMan

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
Didn't work on the Sony Xperia Z, running 4.4.3, sadly.

Looks there's a conflict with another piece of smali...

E/AndroidRuntime( 6579): FATAL EXCEPTION: main

E/AndroidRuntime( 6579): Process: com.android.systemui, PID: 6579

E/AndroidRuntime( 6579): java.lang.ClassCastException: com.android.systemui.statusbar.SlideBrightness cannot be cast to com.android.systemui.settings.ToggleSlider

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.phone.PhoneStatusBar.setUpBrightnessSlider(PhoneStatusBar.java:196)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.phone.PhoneStatusBar.makeStatusBarView(PhoneStatusBar.java:1008)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.phone.PhoneStatusBar.addStatusBarWindow(PhoneStatusBar.java:3089)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.phone.PhoneStatusBar.createAndAddWindows(PhoneStatusBar.java:3059)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.BaseStatusBar.start(BaseStatusBar.java:277)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.phone.PhoneStatusBar.start(PhoneStatusBar.java:589)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.SystemBars.createStatusBarFromConfig(SystemBars.java:106)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.SystemBars.onNoService(SystemBars.java:58)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.ServiceMonitor.startService(ServiceMonitor.java:228)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.ServiceMonitor.access$000(ServiceMonitor.java:49)

E/AndroidRuntime( 6579): at com.android.systemui.statusbar.ServiceMonitor$1.handleMessage(ServiceMonitor.java:73)

E/AndroidRuntime( 6579): at android.os.Handler.dispatchMessage(Handler.java:102)

E/AndroidRuntime( 6579): at android.os.Looper.loop(Looper.java:212)

E/AndroidRuntime( 6579): at android.app.ActivityThread.main(ActivityThread.java:5151)

E/AndroidRuntime( 6579): at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime( 6579): at java.lang.reflect.Method.invoke(Method.java:515)

E/AndroidRuntime( 6579): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)

E/AndroidRuntime( 6579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

E/AndroidRuntime( 6579): at dalvik.system.NativeStart.main(Native Method)
 

TheFixItMan

Senior Member
Jul 8, 2012
7,673
3,934
253
London
Didn't work on the Sony Xperia Z, running 4.4.3, sadly.

Looks there's a conflict with another piece of smali...
I dont have the knowledge to edit smali unfortunately


I dont know if its a kitkat problem or a sony problem - Would only know that if you had cm11 on there


in cm11 it has a toggle smali and a listener service that invokes the brightness slider - so maybe thats missing or different
 
Last edited:
  • Like
Reactions: Ticklefish

vuj1ca

Member
Jun 2, 2014
16
10
0
It works !!!



My phone is ZTE Blade III, CM11 custom rom.
How can i remove slider from quick settings ?
I want it only bellow ribbon tiles, and not in quick settings page...

And when i slide it to the right, scroll indicator is out of the place... See 2nd image...
Thanks for this anyway...
How can i edit this and add auto brighness feature ?
Can you make it ?
 
Last edited:
  • Like
Reactions: TheFixItMan

TheFixItMan

Senior Member
Jul 8, 2012
7,673
3,934
253
London
It works !!!



My phone is ZTE Blade III, CM11 custom rom.
How can i remove slider from quick settings ?
I want it only bellow ribbon tiles, and not in quick settings page...

And when i slide it to the right, scroll indicator is out of the place... See 2nd image...
Thanks for this anyway...
How can i edit this and add auto brighness feature ?
Can you make it ?
You will have to play around with the layout if you want to remove it from the quick panel but that was the only simple layout I found that didn't cause a force close - Anything else I expect would take a lot more changes

With the auto brightness I cant test that because my phone doesn't have a lux sensor for light changes however if you want the smali files you can download them from the cm7/cm9 thread on the first post and add the smali to your systemui and add the xml reference to marcusbrightness.xml- think its quickpannelbrightesssettings.xml from memory or something like that but you will find it in the zip
 

vuj1ca

Member
Jun 2, 2014
16
10
0
You will have to play around with the layout if you want to remove it from the quick panel but that was the only simple layout I found that didn't cause a force close - Anything else I expect would take a lot more changes

With the auto brightness I cant test that because my phone doesn't have a lux sensor for light changes however if you want the smali files you can download them from the cm7/cm9 thread on the first post and add the smali to your systemui and add the xml reference to marcusbrightness.xml- think its quickpannelbrightesssettings.xml from memory or something like that but you will find it in the zip
Ok, i will try that...
So i can follow instructions for cm7/cm9 for that autobrighness code ?
 

bigchrizzieboy

Senior Member
Sep 30, 2007
725
263
63
36
Near Amsterdam
This is what i was looking for!

Awesome!

Never compiled or played with thing like this. BUT will defently gif it a try!
Missing the britghtness slider much on most CM11 roms (on my i9300).
I don't need the icon or an auto button so i'll play around with the layout once i understand the progress :)

THANKS!

edit: DAMN, can't figure it out on my Windows 8.1 laptop...
I almost give up :(
 
Last edited:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone