[GUIDE][CM9/CM10] How to Add BRIGHTNESS SLIDER TO NOTIFICATION PANEL

Search This thread

Adi Aisiteru Reborn

Senior Member
Apr 3, 2013
1,770
4,830
Bandar Lampung
How to Add BRIGHTNESS SLIDER TO NOTIFICATION PANEL for CM9 & CM10



Hi..Hi..Hello XDA :D, especially for Developer only
I want to share to you all how to add brigtness slider to notification panel for your Devices running CyanogenMod 9 & 10

Basically the guide is for Gingerbread, and I use all smali file and code from here http://xdaforums.com/showthread.php?t=2152370
so full credit goes to evanlocked
I just made some change and fix to suit for Device running CM9 & CM10 :)

WARNING !!!
But there is a little bug on this Mod, if you enable Automatic Brightness from your SETTINGS - DISPLAY -BRIGHTNESS - , the Brightness bar will dissappear from notification panel, and never want to show again, so make sure before and after applying this mod, never to do that :)

SEE THE SCREENSHOT :
picture.php


If you can see, there is an Automatic brightness check box,
and the check box is only a fake check box, doesn't have accessibility to access Automatic brightness of our Device. so you are free to tick/check list it, and brightness slider will not dissapear. :)

ok lets go to Guide:
first of all need some requirement for this MOD-GUIDE

REQUIREMENT:
- BRAIN
- Patient
- experience
- Know how to decompile/recompiling Apk file
- notepad++
- Tool for decompiling, : apkmanager/apktool/Virtous/apkmultitools/ or else



STEP 1
Decompile your SytemUI.apk, go to
res/values/ids.xml
and add this line to the end
Code:
 <item type="id" name="automatic">false</item>

NEXT - STEP -2
res/values/strings.xml
Add these two lines to the end
Code:
<string name="brightness_settings_automatic">AUTO</string>
<string name="brightness_settings_title" />

NEXT - STEP -3 for CM10
res/layout/status_bar_expanded.xml
and add the RED line code
Code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@id/notification_panel" android:background="@drawable/notification_panel_bg" android:paddingTop="@dimen/notification_panel_padding_top" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="@dimen/notification_panel_margin_left"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
    <TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network" android:gravity="center" android:layout_gravity="bottom" android:id="@id/carrier_label" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="@dimen/carrier_label_height" android:layout_marginBottom="@dimen/close_handle_height" />
    <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="@dimen/close_handle_underlap">
        <include android:layout_width="fill_parent" android:layout_height="@dimen/notification_panel_header_height" layout="@layout/status_bar_expanded_header" />
        <com.android.systemui.statusbar.powerwidget.PowerWidget android:id="@id/exp_power_stat" android:layout_width="fill_parent" android:layout_height="@dimen/notification_panel_widget_height" />
        [COLOR="Red"]<include layout="@layout/adi_brightness" />[/COLOR]
        <TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly" android:gravity="center" android:id="@id/emergency_calls_only" android:paddingBottom="4.0dip" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" />
        <ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:overScrollMode="always">
            <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/notification_row_min_height" />
        </ScrollView>
    </LinearLayout>
    <com.android.systemui.statusbar.phone.CloseDragHandle android:layout_gravity="bottom" android:orientation="vertical" android:id="@id/close" android:layout_width="fill_parent" android:layout_height="@dimen/close_handle_height">
        <ImageView android:layout_gravity="bottom" android:layout_width="fill_parent" android:layout_height="@dimen/close_handle_height" android:src="@drawable/status_bar_close" android:scaleType="fitXY" />
    </com.android.systemui.statusbar.phone.CloseDragHandle>
</FrameLayout>


NEXT - STEP -3 for CM9
add the RED LINE
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.ExpandedView android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
    <LinearLayout android:orientation="vertical" android:background="@drawable/notification_header_bg" 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" />
        <RelativeLayout android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="52.0dip">
            <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="16.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" />
            <ImageView android:id="@id/settings_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_quicksettings" android:layout_toRightOf="@id/date" android:contentDescription="@string/accessibility_settings_button" />
            <ImageView android:id="@id/clear_all_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_clear" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
        </RelativeLayout>
   [COLOR="Red"]<include layout="@layout/adi_brightness" />[/COLOR]
   </LinearLayout>
    <View android:background="@drawable/status_bar_hr" android:layout_width="fill_parent" android:layout_height="2.0dip" />
    <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">
        <TextView android:textAppearance="@*android:style/TextAppearance.Large" android:gravity="left" android:layout_gravity="top" android:id="@id/noNotificationsTitle" android:padding="8.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/status_bar_no_notifications_title" />
        <ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:overScrollMode="ifContentScrolls">
            <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/notification_height" />
            </LinearLayout>
        </ScrollView>
        <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/title_bar_shadow" android:scaleType="fitXY" />
    </FrameLayout>
</com.android.systemui.statusbar.phone.ExpandedView>


NEXT - STEP -4
FOR CM9, YOU JUST SKIP THIS STEP-4 !!!

res/layout/status_bar_expanded_header
LINE xml 2
Code:
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" [COLOR="Red"]android:background="#ff000000"[/COLOR] android:layout_width="fill_parent" android:layout_height="wrap_content" android:baselineAligned="false"


NEXT - STEP -5
Download the brightness bar source according to your device category :

Source_Brightness_HDPI

Source_Brightness_XHDPI

Source_Brightness_MDPI

Source_Brightness_LDPI


NEXT - STEP -6
Extract you have downloaded and merge it to your decompiled SytemUI.apk

Done and Recompile


I''ve made for my device Galaxy Wonder (HDPI) http://xdaforums.com/showthread.php?t=2230063

and Galaxy Nexus http://xdaforums.com/showthread.php?t=2265104
thanks to Omar1c for testing it :)


CREDIT & THANKS
arco
evanlocked
Omar1c
Galaxy Nexus xda themes forum
Galaxy wonder xda themes forum
XDA
CyanogenMod
ApkMultitools
and all of you , sorry if I missed :)
 

Attachments

  • Source_Brightness_HDPI.zip
    20.2 KB · Views: 878
  • Source_Brightness_LDPI.zip
    18.9 KB · Views: 193
  • Source_Brightness_MDPI.zip
    18.9 KB · Views: 376
  • Source_Brightness_XHDPI.zip
    20.7 KB · Views: 260
  • user5204709_pic34657_1365657471.png
    user5204709_pic34657_1365657471.png
    19.4 KB · Views: 4,852
Last edited:

Adi Aisiteru Reborn

Senior Member
Apr 3, 2013
1,770
4,830
Bandar Lampung
Awesome bro!!

Sent from my Galaxy Nexus using xda premium

I want to write another porting Guide, CM10 O4x style lockscreen, will you test it for XHDPI version ?.
I 'll use your file framework , but before you test it, make sure you revert back to stok theme first, without mod installed on your device.
I'll send you PM when the flashable zip is ready :)

Edit : Done for the porting guide :)
 
Last edited:
  • Like
Reactions: Dr. Narinder

Omar1c

Senior Member
Apr 1, 2013
1,425
1,046
Buckeye
I want to write another porting Guide, CM10 O4x style lockscreen, will you test it for XHDPI version ?.
I 'll use your file framework , but before you test it, make sure you revert back to stok theme first, without mod installed on your device.
I'll send you PM when the flashable zip is ready :)

Edit : Done for the porting guide :)

Alright sorry for the late reply and yeah bro remember I'm your test monkey lul

Sent from my Galaxy Nexus using xda premium
 
  • Like
Reactions: Adi Aisiteru Reborn

Omar1c

Senior Member
Apr 1, 2013
1,425
1,046
Buckeye

Top Liked Posts

  • There are no posts matching your filters.
  • 20
    How to Add BRIGHTNESS SLIDER TO NOTIFICATION PANEL for CM9 & CM10



    Hi..Hi..Hello XDA :D, especially for Developer only
    I want to share to you all how to add brigtness slider to notification panel for your Devices running CyanogenMod 9 & 10

    Basically the guide is for Gingerbread, and I use all smali file and code from here http://xdaforums.com/showthread.php?t=2152370
    so full credit goes to evanlocked
    I just made some change and fix to suit for Device running CM9 & CM10 :)

    WARNING !!!
    But there is a little bug on this Mod, if you enable Automatic Brightness from your SETTINGS - DISPLAY -BRIGHTNESS - , the Brightness bar will dissappear from notification panel, and never want to show again, so make sure before and after applying this mod, never to do that :)

    SEE THE SCREENSHOT :
    picture.php


    If you can see, there is an Automatic brightness check box,
    and the check box is only a fake check box, doesn't have accessibility to access Automatic brightness of our Device. so you are free to tick/check list it, and brightness slider will not dissapear. :)

    ok lets go to Guide:
    first of all need some requirement for this MOD-GUIDE

    REQUIREMENT:
    - BRAIN
    - Patient
    - experience
    - Know how to decompile/recompiling Apk file
    - notepad++
    - Tool for decompiling, : apkmanager/apktool/Virtous/apkmultitools/ or else



    STEP 1
    Decompile your SytemUI.apk, go to
    res/values/ids.xml
    and add this line to the end
    Code:
     <item type="id" name="automatic">false</item>

    NEXT - STEP -2
    res/values/strings.xml
    Add these two lines to the end
    Code:
    <string name="brightness_settings_automatic">AUTO</string>
    <string name="brightness_settings_title" />

    NEXT - STEP -3 for CM10
    res/layout/status_bar_expanded.xml
    and add the RED line code
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout android:id="@id/notification_panel" android:background="@drawable/notification_panel_bg" android:paddingTop="@dimen/notification_panel_padding_top" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="@dimen/notification_panel_margin_left"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network" android:gravity="center" android:layout_gravity="bottom" android:id="@id/carrier_label" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="@dimen/carrier_label_height" android:layout_marginBottom="@dimen/close_handle_height" />
        <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="@dimen/close_handle_underlap">
            <include android:layout_width="fill_parent" android:layout_height="@dimen/notification_panel_header_height" layout="@layout/status_bar_expanded_header" />
            <com.android.systemui.statusbar.powerwidget.PowerWidget android:id="@id/exp_power_stat" android:layout_width="fill_parent" android:layout_height="@dimen/notification_panel_widget_height" />
            [COLOR="Red"]<include layout="@layout/adi_brightness" />[/COLOR]
            <TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly" android:gravity="center" android:id="@id/emergency_calls_only" android:paddingBottom="4.0dip" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" />
            <ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:overScrollMode="always">
                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/notification_row_min_height" />
            </ScrollView>
        </LinearLayout>
        <com.android.systemui.statusbar.phone.CloseDragHandle android:layout_gravity="bottom" android:orientation="vertical" android:id="@id/close" android:layout_width="fill_parent" android:layout_height="@dimen/close_handle_height">
            <ImageView android:layout_gravity="bottom" android:layout_width="fill_parent" android:layout_height="@dimen/close_handle_height" android:src="@drawable/status_bar_close" android:scaleType="fitXY" />
        </com.android.systemui.statusbar.phone.CloseDragHandle>
    </FrameLayout>


    NEXT - STEP -3 for CM9
    add the RED LINE
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <com.android.systemui.statusbar.phone.ExpandedView android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <LinearLayout android:orientation="vertical" android:background="@drawable/notification_header_bg" 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" />
            <RelativeLayout android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="52.0dip">
                <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="16.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" />
                <ImageView android:id="@id/settings_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_quicksettings" android:layout_toRightOf="@id/date" android:contentDescription="@string/accessibility_settings_button" />
                <ImageView android:id="@id/clear_all_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_clear" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
            </RelativeLayout>
       [COLOR="Red"]<include layout="@layout/adi_brightness" />[/COLOR]
       </LinearLayout>
        <View android:background="@drawable/status_bar_hr" android:layout_width="fill_parent" android:layout_height="2.0dip" />
        <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">
            <TextView android:textAppearance="@*android:style/TextAppearance.Large" android:gravity="left" android:layout_gravity="top" android:id="@id/noNotificationsTitle" android:padding="8.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/status_bar_no_notifications_title" />
            <ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:overScrollMode="ifContentScrolls">
                <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
                    <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/notification_height" />
                </LinearLayout>
            </ScrollView>
            <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/title_bar_shadow" android:scaleType="fitXY" />
        </FrameLayout>
    </com.android.systemui.statusbar.phone.ExpandedView>


    NEXT - STEP -4
    FOR CM9, YOU JUST SKIP THIS STEP-4 !!!

    res/layout/status_bar_expanded_header
    LINE xml 2
    Code:
    <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" [COLOR="Red"]android:background="#ff000000"[/COLOR] android:layout_width="fill_parent" android:layout_height="wrap_content" android:baselineAligned="false"


    NEXT - STEP -5
    Download the brightness bar source according to your device category :

    Source_Brightness_HDPI

    Source_Brightness_XHDPI

    Source_Brightness_MDPI

    Source_Brightness_LDPI


    NEXT - STEP -6
    Extract you have downloaded and merge it to your decompiled SytemUI.apk

    Done and Recompile


    I''ve made for my device Galaxy Wonder (HDPI) http://xdaforums.com/showthread.php?t=2230063

    and Galaxy Nexus http://xdaforums.com/showthread.php?t=2265104
    thanks to Omar1c for testing it :)


    CREDIT & THANKS
    arco
    evanlocked
    Omar1c
    Galaxy Nexus xda themes forum
    Galaxy wonder xda themes forum
    XDA
    CyanogenMod
    ApkMultitools
    and all of you , sorry if I missed :)
    3
    Reserved for something :)
    2

    Screenshot will be appreciated :)

    Sent from my GT-I8150 using xda app-developers app
    2
    I tried and it worked well but I think that the auto brightness option is useless so I want to remove that. Can you explain me how to do that?

    Thanks in advance

    Res/layout/adi_brightness.xml
    Remove one line which calling check box

    Sent from my GT-I8150 using xda app-developers app
    1
    please friends, any1 can help regarding implementing brightness sliders in notification bar of cm11 roms. No one seems to respond.

    yes, anyone can help regarding brightness sliders for cm11 roms?

    Is there a way to add sliders on cm11 based roms ?
    Adding Brighness and Volume sliders would be great, something that i realy like.
    I don't want to swipe finger over status bar...

    ANy chance for that on CM 11 now ? Or a Xposed Modul maybe ?

    I did it on cm11 ages ago
    http://xdaforums.com/android/general/guide-how-to-add-visible-brightness-t2801134