Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP Adi Aisiteru Reborn

7th May 2013, 04:12 PM   |  #1  
Adi Aisiteru Reborn's Avatar
OP Senior Member
Flag Bandar Lampung
Thanks Meter: 4,589
 
1,666 posts
Join Date:Joined: Apr 2013
How to Add BRIGHTNESS SLIDER TO NOTIFICATION PANEL for CM9 & CM10



Hi..Hi..Hello XDA , 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://forum.xda-developers.com/show....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 :


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" />
        <include layout="@layout/adi_brightness" />
        <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>
   <include layout="@layout/adi_brightness" />
   </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" android:background="#ff000000" 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://forum.xda-developers.com/show....php?t=2230063

and Galaxy Nexus http://forum.xda-developers.com/show....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
Attached Thumbnails
Click image for larger version

Name:	user5204709_pic34657_1365657471.png
Views:	3462
Size:	19.4 KB
ID:	1942997  
Attached Files
File Type: zip Source_Brightness_HDPI.zip - [Click for QR Code] (20.2 KB, 488 views)
File Type: zip Source_Brightness_LDPI.zip - [Click for QR Code] (18.9 KB, 138 views)
File Type: zip Source_Brightness_MDPI.zip - [Click for QR Code] (18.9 KB, 214 views)
File Type: zip Source_Brightness_XHDPI.zip - [Click for QR Code] (20.7 KB, 136 views)
Last edited by Adi Aisiteru Reborn; 14th June 2013 at 06:06 AM. Reason: Change tittle : GUIDE WORK TO CM9 TOO
The Following 18 Users Say Thank You to Adi Aisiteru Reborn For This Useful Post: [ View ]
7th May 2013, 04:12 PM   |  #2  
Adi Aisiteru Reborn's Avatar
OP Senior Member
Flag Bandar Lampung
Thanks Meter: 4,589
 
1,666 posts
Join Date:Joined: Apr 2013
Reserved for something
The Following 3 Users Say Thank You to Adi Aisiteru Reborn For This Useful Post: [ View ]
7th May 2013, 05:37 PM   |  #3  
MicroLizard's Avatar
Senior Member
Flag Bandung, ID
Thanks Meter: 204
 
248 posts
Join Date:Joined: Feb 2012
Donate to Me
More
will this mod work on CM10.1 ?
7th May 2013, 05:54 PM   |  #4  
Adi Aisiteru Reborn's Avatar
OP Senior Member
Flag Bandar Lampung
Thanks Meter: 4,589
 
1,666 posts
Join Date:Joined: Apr 2013
Quote:
Originally Posted by MicroLizard

will this mod work on CM10.1 ?

No , still force close..
I still try and try to get it working..

PS : But it will work to CM9

Sent from my GT-I8150 using xda app-developers app
The Following User Says Thank You to Adi Aisiteru Reborn For This Useful Post: [ View ]
7th May 2013, 05:59 PM   |  #5  
MicroLizard's Avatar
Senior Member
Flag Bandung, ID
Thanks Meter: 204
 
248 posts
Join Date:Joined: Feb 2012
Donate to Me
More
Quote:
Originally Posted by Adi Aisiteru Reborn

No , still force close..
I still try and try to get it working..

PS : But it will work to CM9

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

Yes, I've tried and it give me force close.
7th May 2013, 06:33 PM   |  #6  
Senior Member
Thanks Meter: 417
 
385 posts
Join Date:Joined: Feb 2012
Big thanks!!
Last edited by androidphone2012; 7th May 2013 at 08:38 PM.
7th May 2013, 06:35 PM   |  #7  
LoLaTiOn's Avatar
Recognized Contributor
Flag Tours
Thanks Meter: 9,128
 
2,646 posts
Join Date:Joined: Feb 2012
More
Thank you bro work fine
Attached Thumbnails
Click image for larger version

Name:	Brightness_bar.jpg
Views:	1003
Size:	20.2 KB
ID:	1943383  
The Following User Says Thank You to LoLaTiOn For This Useful Post: [ View ]
7th May 2013, 11:52 PM   |  #8  
Adi Aisiteru Reborn's Avatar
OP Senior Member
Flag Bandar Lampung
Thanks Meter: 4,589
 
1,666 posts
Join Date:Joined: Apr 2013
Quote:
Originally Posted by androidphone2012

Big thanks!!

Screenshot will be appreciated

Sent from my GT-I8150 using xda app-developers app
The Following 2 Users Say Thank You to Adi Aisiteru Reborn For This Useful Post: [ View ]
8th May 2013, 12:27 AM   |  #9  
Omar1c's Avatar
Senior Member
Flag Buckeye
Thanks Meter: 970
 
1,347 posts
Join Date:Joined: Apr 2013
More
Awesome bro!!

Sent from my Galaxy Nexus using xda premium
8th May 2013, 12:55 AM   |  #10  
Adi Aisiteru Reborn's Avatar
OP Senior Member
Flag Bandar Lampung
Thanks Meter: 4,589
 
1,666 posts
Join Date:Joined: Apr 2013
Quote:
Originally Posted by Omar1c

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 by Adi Aisiteru Reborn; 8th May 2013 at 11:36 AM.

The Following User Says Thank You to Adi Aisiteru Reborn For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes