[GUIDE] Brightness Slider Guide Stock GB CM7/CM9/CM11 - Rewritten Easy To Follow

Search This thread

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
Brightness Slider Guide


For CM11 See My Guide - Here



I have re-written the guide by @evanlocked with his permission as some people had trouble following his guide so I'll try to make it simple to follow steps
Full credit goes to him for the original guide and steps - All I have done is present it and re-write it in a different way to make it more understandable and iv also added steps for different layouts depending on what rom you are using

The original thread can be found
http://xdaforums.com/showthread.php?t=2152370


1 - Download the attachment and unzip the folder

2 - Decompile your SystemUI.apk with apktool

3 - Open the downloaded attachment and copy the files within to the following locations to your decompiled SystemUI folder
Note if you dont have the folder for the smali eg lidroid just create it

smali\com\lidroid\systemui\quickpanel
BrightnessSlider$BrightnessSettingsObserver.smali
BrightnessSlider.smali

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

smali\com\android\systemui\statusbar\quickpanel
BrightnessSettingsView$1.smali
BrightnessSettingsView$AutomaticObserver.smali
BrightnessSettingsView$BrightnessObserver.smali

res\drawable
brightness_seekbar.xml

res\layout
qp_brightness.xml
quickpanel_brightness_settings.xml

res\drawable-ldpi (or -mdpi and so on depending on your phone res)
brightness_bg.png
ic_brightness.png
quickpanel_brightness_icon.png


4 - Open res/values/strings.xml with notepad++

above </resources> place the following

Code:
<string name="brightness_settings_title" />
    <string name="brightness_settings_automatic" />


5 - Open res/values/ids.xml with notepad++

above </resources> place the following (note cm9 dont add <item type="id" name="brightness">false</item> as its already defined)

Code:
<item type="id" name="title">false</item>
    <item type="id" name="brightness">false</item>
	<item type="id" name="automatic">false</item>


6 - Open res/layout/status_bar_expanded.xml

This step will vary depending on rom so I will give a few examples


Example 1 - Stock Gingerbread (deodexed)

Under
Code:
 <com.android.systemui.statusbar.NotificationLinearLayout android:orientation="vertical" android:id="@id/notificationLinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="6.0dip">

Place
Code:
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
                    <include layout="@layout/qp_brightness" />
                </LinearLayout>


Example 2 - CM7

If you have a header you can place it under it like this (note your header name maybe different from StatusBarJellyHeaderView)

Under
Code:
 <com.android.systemui.statusbar.StatusBarJellyHeaderView android:layout_width="wrap_content" android:layout_height="wrap_content" />
            <TextView android:textSize="14.0sp" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/clear_all_button" android:paddingLeft="15.0dip" android:paddingRight="15.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4.0dip" android:layout_marginBottom="1.0dip" android:text="@string/status_bar_clear_all_button" style="StatusBar.ClearButton" />

Place
Code:
<include layout="@layout/qp_brightness" />


Or if you dont have a header or you dont want it within the header you can place it under the power widget

Under
Code:
<com.android.systemui.statusbar.powerwidget.PowerWidget android:id="@id/exp_power_stat" android:layout_width="fill_parent" android:layout_height="wrap_content" />

Place
Code:
<include layout="@layout/qp_brightness" />


Example 3 - CM9

Above
Code:
 <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">

Place
Code:
<LinearLayout android:orientation="horizontal" android:background="@drawable/notification_header_bg" android:layout_width="fill_parent" android:layout_height="wrap_content">
                    <include layout="@layout/qp_brightness" />
                </LinearLayout>
    <View android:background="@drawable/status_bar_hr" android:layout_width="fill_parent" android:layout_height="2.0dip" />



7 - This step is optional and is for the icon next to the brightness slider

open res/layout/qp_brightness.xml

Look at
Code:
 <ImageView android:paddingLeft="3.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_brightness" />
This is the line for the image - change it how you like if you want to

note - to change the icon just replace ic_brightness.png that you placed in res/drawable-ldpi (or mdpi and so on) with one of your choice but make sure the filename remains ic_brightness.png


8 - Recompile and sign - if you are using cm7/9 sign the apk with a platform key using zip signer (playstore)

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





credits
evanlocked
 

Attachments

  • Brightness_Slider_Files.zip
    16.5 KB · Views: 1,304
Last edited:

Ticklefish

Recognized Themer
Oct 27, 2011
6,773
8,627
Hampshire, UK
SystemUI FC'd on my phone..

Mind you, I am using a Sony Xperia Z running 4.3 and this thread is meant for GB and is in a Samsung forum so I could just be bringing it upon myself...lol
 

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
SystemUI FC'd on my phone..

Mind you, I am using a Sony Xperia Z running 4.3 and this thread is meant for GB and is in a Samsung forum so I could just be bringing it upon myself...lol

I dont have a phone running 4.3 to test it on - iv tested on stock gb aosp gb cm7 and cm9

I do know it works on non samsung phones as someone else asked me about a bug in the brightness returning to a set level on restart but it turns out it was a bug to do with how his phone manages brightness

I dont know if the smali works on 4.3 but im sure if you had cm11 you have a brightness slider anyway if you enable in cyanogenmod settings and then swipe across the statusbar although it may not be a visable slider

it maybe just a case you need to arrange the layout for including qp_brightness in a different way to stop the force closing but Im not able to test this

you can try putting it where it is in the cm9 layout if your status_bar_expanded looks similar or just find somewhere else to place it

feel free to upload an unmodified systemui.apk and your framework-res and I will do it and you can see if it works but since iv not done it on a 4.3 phone Im not sure if it will work
 
Last edited:

Ticklefish

Recognized Themer
Oct 27, 2011
6,773
8,627
Hampshire, UK
I dont have a phone running 4.3 to test it on - iv tested on stock gb aosp gb cm7 and cm9

I do know it works on non samsung phones as someone else asked me about a bug in the brightness returning to a set level on restart but it turns out it was a bug to do with how his phone manages brightness

I dont know if the smali works on 4.3 but im sure if you had cm11 you have a brightness slider anyway if you enable in cyanogenmod settings and then swipe across the statusbar although it may not be a visable slider

it maybe just a case you need to arrange the layout for including qp_brightness in a different way to stop the force closing but Im not able to test this

you can try putting it where it is in the cm9 layout if your status_bar_expanded looks similar or just find somewhere else to place it

feel free to upload an unmodified systemui.apk and your framework-res and I will do it and you can see if it works but since iv not done it on a 4.3 phone Im not sure if it will work

Oh, I've got a brightness bar already. I've pinched one from statusbargreper but it's not the best. I was hoping to use this one so that the brightness changes instantly (with the statusbargreper smali, the brightness changes when you take your finger off the screen).

I'm uploading my framework-res.apk, stock SystemUI.apk and also the SystemUI.apk I made with this mod. Just in case..

https://www.mediafire.com/?hq98l4epd1qhs23
 

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
Oh, I've got a brightness bar already. I've pinched one from statusbargreper but it's not the best. I was hoping to use this one so that the brightness changes instantly (with the statusbargreper smali, the brightness changes when you take your finger off the screen).

I'm uploading my framework-res.apk, stock SystemUI.apk and also the SystemUI.apk I made with this mod. Just in case..

https://www.mediafire.com/?hq98l4epd1qhs23

iv done some test SystemUI.apk for you

in each one all iv done is move the layout of qp_brightness around so hopefully one of the layouts wont cause a force close

let me know if any work and I can add it to the guide

just rename the apks SystemUI.apk and flash them with a flashable zip - im sure you know already

http://d-h.st/Rdw
 
  • Like
Reactions: Ticklefish

Ticklefish

Recognized Themer
Oct 27, 2011
6,773
8,627
Hampshire, UK
iv done some test SystemUI.apk for you

in each one all iv done is move the layout of qp_brightness around so hopefully one of the layouts wont cause a force close

let me know if any work and I can add it to the guide

just rename the apks SystemUI.apk and flash them with a flashable zip - im sure you know already

http://d-h.st/Rdw

Thanks, I'll have to check them out tomorrow. :)

Sent from my C6603 using Tapatalk
 

GSculerlor

Senior Member
Oct 23, 2013
441
89
Malang
How to fix this layout problem ?

Sent from my GT-S5360 using xda app-developers app
 

Attachments

  • uploadfromtaptalk1398499151785.jpg
    uploadfromtaptalk1398499151785.jpg
    16.2 KB · Views: 350

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
How to fix this layout problem ?

Sent from my GT-S5360 using xda app-developers app

the png on left is already explained in step 7

the colour of the slider itself is to do with your framework-res in progress_horizontal.xml

the slider icon on the bar is also to do with your framework but I dont know what png it is - I think its a .9.png somewhere - you will have to look through as the names may vary with rom
 
Last edited:

Ticklefish

Recognized Themer
Oct 27, 2011
6,773
8,627
Hampshire, UK
iv done some test SystemUI.apk for you

in each one all iv done is move the layout of qp_brightness around so hopefully one of the layouts wont cause a force close

let me know if any work and I can add it to the guide

just rename the apks SystemUI.apk and flash them with a flashable zip - im sure you know already

http://d-h.st/Rdw

FC's on all four, I'm afraid. I don't think this is a layout issue, it's probably a smali/4.3 thing. Which is a bugger.
 

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
Not that it's got anything with your topic to do, but I thought I'd might ask anyway.

I followed this guide to create another clear button:

http://xdaforums.com/showthread.php?t=1953934

Which works good, but I would like the clear button to be aligned to the right on the row.
Is there any possibilities to that? :)

Iv used that mod in my status bar - you can try changing the gravity of the linear layout
here is link to my status bar if you want to compare
http://xdaforums.com/showthread.php?p=49468255
 

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
It wasn't as easy as this though: android:gravity="right" :)

that will only work if its in its own layout else everything in that layout will go to the right

you could also try to increase its padding on one side which might shift it over
Code:
android:paddingLeft="8.0dip"


and I think theres also a next to command which will put it next to a certain @ID

for example
Code:
android:layout_toRightOf="@id/date"
which will put it to the right hand side of the date


you will just have to play around with the layout to get it how you want
 
Last edited:

richard.elgh

Senior Member
Mar 24, 2013
339
42
that will only work if its in its own layout else everything in that layout will go to the right

you could also try to increase its padding on one side which might shift it over
Code:
android:paddingLeft="8.0dip"


and I think theres also a next to command which will put it next to a certain @ID

for example
Code:
android:layout_toRightOf="@id/date"
which will put it to the right hand side of the date


you will just have to play around with the layout to get it how you want

This is my command:

<TextView android:textColor="@android:color/transparent" android:layout_gravity="center_vertical"" android:id="@id/clear_all_button" android:paddingLeft="15.0dip" android:paddingRight="15.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4.0dip" android:layout_marginBottom="1.0dip" android:text="@string/status_bar_clear_all_button" style="@style/Awesome.Button" />

Just decreasing the paddingRight didn't make a change, but I can try changing the paddingLeft tomorrow. :)

Thanks.
 

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
This is my command:

<TextView android:textColor="@android:color/transparent" android:layout_gravity="center_vertical"" android:id="@id/clear_all_button" android:paddingLeft="15.0dip" android:paddingRight="15.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4.0dip" android:layout_marginBottom="1.0dip" android:text="@string/status_bar_clear_all_button" style="@style/Awesome.Button" />

Just decreasing the paddingRight didn't make a change, but I can try changing the paddingLeft tomorrow. :)

Thanks.

this is my layout for comparison - you can see what it looks like in the screenshot of the status bar thread I gave in last post or in my signature

Code:
<LinearLayout android:orientation="vertical" android:id="@id/power_and_carrier" android:background="@drawable/title_bar_portrait" android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content">
        <com.android.systemui.statusbar.powerwidget.PowerWidget android:id="@id/exp_power_stat" android:layout_width="fill_parent" android:layout_height="wrap_content" />
        <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/carrier_label_layout" android:layout_width="fill_parent" android:layout_height="wrap_content">
            <com.android.systemui.statusbar.StatusBarJellyHeaderView android:layout_width="wrap_content" android:layout_height="wrap_content" />
            <TextView android:textSize="14.0sp" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/clear_all_button" android:paddingLeft="15.0dip" android:paddingRight="15.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4.0dip" android:layout_marginBottom="1.0dip" android:text="@string/status_bar_clear_all_button" style="StatusBar.ClearButton" />
            <include layout="@layout/qp_brightness" />
        </LinearLayout>
    </LinearLayout>
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    Brightness Slider Guide


    For CM11 See My Guide - Here



    I have re-written the guide by @evanlocked with his permission as some people had trouble following his guide so I'll try to make it simple to follow steps
    Full credit goes to him for the original guide and steps - All I have done is present it and re-write it in a different way to make it more understandable and iv also added steps for different layouts depending on what rom you are using

    The original thread can be found
    http://xdaforums.com/showthread.php?t=2152370


    1 - Download the attachment and unzip the folder

    2 - Decompile your SystemUI.apk with apktool

    3 - Open the downloaded attachment and copy the files within to the following locations to your decompiled SystemUI folder
    Note if you dont have the folder for the smali eg lidroid just create it

    smali\com\lidroid\systemui\quickpanel
    BrightnessSlider$BrightnessSettingsObserver.smali
    BrightnessSlider.smali

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

    smali\com\android\systemui\statusbar\quickpanel
    BrightnessSettingsView$1.smali
    BrightnessSettingsView$AutomaticObserver.smali
    BrightnessSettingsView$BrightnessObserver.smali

    res\drawable
    brightness_seekbar.xml

    res\layout
    qp_brightness.xml
    quickpanel_brightness_settings.xml

    res\drawable-ldpi (or -mdpi and so on depending on your phone res)
    brightness_bg.png
    ic_brightness.png
    quickpanel_brightness_icon.png


    4 - Open res/values/strings.xml with notepad++

    above </resources> place the following

    Code:
    <string name="brightness_settings_title" />
        <string name="brightness_settings_automatic" />


    5 - Open res/values/ids.xml with notepad++

    above </resources> place the following (note cm9 dont add <item type="id" name="brightness">false</item> as its already defined)

    Code:
    <item type="id" name="title">false</item>
        <item type="id" name="brightness">false</item>
    	<item type="id" name="automatic">false</item>


    6 - Open res/layout/status_bar_expanded.xml

    This step will vary depending on rom so I will give a few examples


    Example 1 - Stock Gingerbread (deodexed)

    Under
    Code:
     <com.android.systemui.statusbar.NotificationLinearLayout android:orientation="vertical" android:id="@id/notificationLinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="6.0dip">

    Place
    Code:
    <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
                        <include layout="@layout/qp_brightness" />
                    </LinearLayout>


    Example 2 - CM7

    If you have a header you can place it under it like this (note your header name maybe different from StatusBarJellyHeaderView)

    Under
    Code:
     <com.android.systemui.statusbar.StatusBarJellyHeaderView android:layout_width="wrap_content" android:layout_height="wrap_content" />
                <TextView android:textSize="14.0sp" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/clear_all_button" android:paddingLeft="15.0dip" android:paddingRight="15.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4.0dip" android:layout_marginBottom="1.0dip" android:text="@string/status_bar_clear_all_button" style="StatusBar.ClearButton" />

    Place
    Code:
    <include layout="@layout/qp_brightness" />


    Or if you dont have a header or you dont want it within the header you can place it under the power widget

    Under
    Code:
    <com.android.systemui.statusbar.powerwidget.PowerWidget android:id="@id/exp_power_stat" android:layout_width="fill_parent" android:layout_height="wrap_content" />

    Place
    Code:
    <include layout="@layout/qp_brightness" />


    Example 3 - CM9

    Above
    Code:
     <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">

    Place
    Code:
    <LinearLayout android:orientation="horizontal" android:background="@drawable/notification_header_bg" android:layout_width="fill_parent" android:layout_height="wrap_content">
                        <include layout="@layout/qp_brightness" />
                    </LinearLayout>
        <View android:background="@drawable/status_bar_hr" android:layout_width="fill_parent" android:layout_height="2.0dip" />



    7 - This step is optional and is for the icon next to the brightness slider

    open res/layout/qp_brightness.xml

    Look at
    Code:
     <ImageView android:paddingLeft="3.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_brightness" />
    This is the line for the image - change it how you like if you want to

    note - to change the icon just replace ic_brightness.png that you placed in res/drawable-ldpi (or mdpi and so on) with one of your choice but make sure the filename remains ic_brightness.png


    8 - Recompile and sign - if you are using cm7/9 sign the apk with a platform key using zip signer (playstore)

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





    credits
    evanlocked
    2
    many greet . @Ticklefish and @marcussmith2626 - thank

    after using apktool 1.5.2 - i can recompile it w/o prob . it work like perfectly .
    vuhusygy.jpg


    Sent from my GT-S5360 using Tapatalk 2
    1
    Will follow this one

    EDIT:
    thanks @marcussmith2626
    workin perfectly :)
    no force close or what
    1
    Oh, I've got a brightness bar already. I've pinched one from statusbargreper but it's not the best. I was hoping to use this one so that the brightness changes instantly (with the statusbargreper smali, the brightness changes when you take your finger off the screen).

    I'm uploading my framework-res.apk, stock SystemUI.apk and also the SystemUI.apk I made with this mod. Just in case..

    https://www.mediafire.com/?hq98l4epd1qhs23

    iv done some test SystemUI.apk for you

    in each one all iv done is move the layout of qp_brightness around so hopefully one of the layouts wont cause a force close

    let me know if any work and I can add it to the guide

    just rename the apks SystemUI.apk and flash them with a flashable zip - im sure you know already

    http://d-h.st/Rdw
    1
    I know this is a necro topic, but i hope i could get some help :p

    So whenever i try to recompile my systemui with this added it gives me the
    Error for input '.parameter': Invalid directive
    Which i believe is caused by the old version of smali (apktool 1.5.2 or lower) and me using 2.1.0.
    I was trying to fix this by converting the smali to a newer version , but whenever i try to de- and then recompile any .apk with 1.5.2 it just gives me a lot of errors (I have tried reinstalling framework-res.apk with the older version of apktool), so could anyone please try to convert the smali to a newer version? Any help would be appreciated. :)

    I have a dummy apk file I use for this sort of thing.

    I decompile it with 1.5.2, add the smali files, then recompile it. If I then decompile it with 2.1.0, the smali files have been converted.

    You can download it if you want from here: https://www.mediafire.com/download/ciq22sy27tfef7f

    You'll have to uninstall any frameworks before you can use it, though. You can always reinstall them again once you've finished.

    Sent from my Sony Xperia Z3 Compact using XDA Labs