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

[MOD][HOW-TO] Enable/disable brightness slider with toggle!

OP loserskater

13th March 2013, 09:03 AM   |  #1  
loserskater's Avatar
OP Recognized Developer
Flag East Stroudsburg, PA
Thanks Meter: 3,318
 
1,851 posts
Join Date:Joined: Jun 2008
Donate to Me
More
This will allow you to enable and disable the brightness slider right from the settings menu.
No more flashing extra zips, or having to build another SystemUI!

Let's get to it!

The two files we'll be working with are:
SecSettings.apk
SystemUI.apk

First let's start with SecSettings.apk

Navigate to res/values/string.xml
And add the following lines to the bottom:
Code:
    <string name="brightness_slider_title">Display brightness slider</string>
    <string name="brightness_slider_summary">Show brightness slider in notification panel</string>



Next navigate to res/xml/display_settings.xml
Add the line in red:
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/display_settings"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
    <PreferenceCategory android:title="@string/tts_general_section_title" />
    <PreferenceScreen android:title="@string/wallpaper" android:key="wallpaper" android:fragment="com.android.settings.WallpaperSettings" />
    <PreferenceScreen android:title="@string/led_indicator_settings" android:key="led_indicator_settings" android:fragment="com.android.settings.LedIndicatorSettings" />
    <SwitchPreferenceScreen android:title="@string/page_buddy" android:key="contextualpage_settings" android:summary="@string/page_buddy_summary" android:fragment="com.android.settings.ContextualPageSettings" />
    <PreferenceCategory android:title="@string/display_label" android:key="screen_category" />
    <PreferenceScreen android:title="@string/screen_mode_setting" android:key="mode" android:summary="@string/screen_mode_summary">
        <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.ModePreview" />
    </PreferenceScreen>
    <com.android.settings.BrightnessPreference android:title="@string/brightness" android:key="brightness" android:widgetLayout="@layout/round_more_icon" android:dialogTitle="@string/brightness" />
    <CheckBoxPreference android:title="@string/accelerometer_title_second" android:key="accelerometer_second" />
    <CheckBoxPreference android:title="@string/accelerometer_title" android:key="accelerometer" />
    <ListPreference android:persistent="false" android:entries="@array/screen_timeout_entries" android:title="@string/screen_timeout" android:key="screen_timeout" android:summary="@string/screen_timeout_summary" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/screen_timeout_values" />
    <PreferenceScreen android:title="@string/screensaver_settings_title" android:key="screensaver" android:fragment="com.android.settings.DreamSettings" />
    <CheckBoxPreference android:title="@string/brightness_slider_title" android:key="display_brightness_slider" android:summary="@string/brightness_slider_summary" />
    <PreferenceCategory android:title="@string/features_category_title" android:key="features_category" />
    <CheckBoxPreference android:title="@string/intelligent_rotation_title" android:key="intelligent_rotation" android:summary="@string/intelligent_rotation_summary" />
    <CheckBoxPreference android:title="@string/intelligent_sleep_title" android:key="intelligent_sleep" android:summary="@string/intelligent_sleep_summary" />
    <PreferenceCategory android:title="@string/font" />
    <com.android.settings.flipfont.FontListPreference android:title="@string/monotype_preference_title" android:key="MONOTYPE" android:summary="@string/monotype_preference_summary" android:widgetLayout="@layout/round_more_icon" />
    <com.android.settings.FontSizeListPreference android:entries="@array/entries_font_size" android:title="@string/title_font_size" android:key="font_size" android:summary="@string/summary_font_size" android:widgetLayout="@layout/round_more_icon" android:dialogTitle="@string/dialog_title_font_size" android:entryValues="@array/entryvalues_font_size" />
    <PreferenceCategory android:title="@string/more_settings" android:key="more_settings" />
    <ListPreference android:persistent="false" android:entries="@array/quick_launch_entries" android:title="@string/quick_launch_title" android:key="quick_launch" android:summary="@string/screen_quick_launch_summary" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/quick_launch_values" />
    <CheckBoxPreference android:title="@string/sub_lcd_auto_lock" android:key="sub_lcd_auto_lock" android:summary="@string/sub_lcd_auto_lock_summary" />
    <CheckBoxPreference android:title="@string/key_night_mode" android:key="key_night_mode" />
    <ListPreference android:persistent="false" android:entries="@array/key_backlight_entries" android:title="@string/key_backlight" android:key="key_backlight" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/key_backlight_values" />
    <ListPreference android:persistent="false" android:entries="@array/touch_key_light_entries" android:title="@string/touch_key_light" android:key="touch_key_light" android:summary="@string/touch_key_light_summary" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/touch_key_light_values" />
    <CheckBoxPreference android:persistent="false" android:title="@string/display_battery_percentage" android:key="display_battery_level" android:summary="@string/display_battery_percentage_summary" />
    <CheckBoxPreference android:persistent="false" android:title="@string/display_saving" android:key="power_saving_mode" android:summary="@string/display_saving_mode_summary" />
    <CheckBoxPreference android:persistent="false" android:title="@string/notification_pulse_title" android:key="notification_pulse" />
    <CheckBoxPreference android:title="@string/edgezoom_title" android:key="edgezoom_toggle" android:summary="@string/edgezoom_summary" />
</PreferenceScreen>


Next navigate to smali/com/android/settings/DisplaySettings.smali
Add the following in red:
Code:
.field private mBrightness:Lcom/android/settings/BrightnessPreference;

.field private mBrightnessPreference:Lcom/android/settings/BrightnessPreference;

.field private mBrightnessSliderPreference:Landroid/preference/CheckBoxPreference;

.field private mContextualPage:Landroid/preference/SwitchPreferenceScreen;

.field protected mContextualPageUncheckerHandler:Landroid/os/Handler;


.method private updateState
Add the sections in red
Code:
    iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v4, "display_battery_percentage"

    invoke-static {v0, v4, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v0

    if-eqz v0, :cond_3

    move v0, v1

    :goto_2
    invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mBrightnessSliderPreference:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v4, "display_brightness_slider"

    invoke-static {v0, v4, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v0

    if-eqz v0, :cond_bs

    move v0, v1

    :goto_bs
    invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    .line 807
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mTouchKeyLight:Landroid/preference/ListPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "button_key_light"

    const/16 v5, 0x5dc

    invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

Code:
    :cond_2
    move v0, v2

    .line 802
    goto :goto_1

    :cond_3
    move v0, v2

    .line 805
    goto :goto_2

    :cond_bs
    move v0, v2

    goto :goto_bs
    
    :cond_4
    move v0, v2

    .line 811
    goto :goto_3

    :cond_5
    move v1, v2

    .line 812
    goto :goto_4
.end method


.method public onCreate
Add the parts in red:
Code:
    const-string v11, "display_battery_level"

    invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v11

    check-cast v11, Landroid/preference/CheckBoxPreference;

    iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;

    const-string v11, "display_brightness_slider"

    invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v11

    check-cast v11, Landroid/preference/CheckBoxPreference;

    iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mBrightnessSliderPreference:Landroid/preference/CheckBoxPreference;

    .line 398
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getActivity()Landroid/app/Activity;

    move-result-object v11

    invoke-static {v11}, Lcom/android/settings/Utils;->isTablet(Landroid/content/Context;)Z

    move-result v11

    if-eqz v11, :cond_6


.method public onPreferenceTreeClick
Add the parts in red
Code:
    :cond_4
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_6

    .line 875
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    .line 876
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "display_battery_percentage"

    if-eqz v0, :cond_5

    move v2, v1

    :cond_5
    invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto :goto_2

    .line 878
    :cond_6
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBrightnessSliderPreference:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_next

    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBrightnessSliderPreference:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "display_brightness_slider"

    if-eqz v0, :cond_bright

    move v2, v1

    :cond_bright
    invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto :goto_2
    
    :cond_next
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mNotificationPulse:Landroid/preference/CheckBoxPreference;

    if-ne p2, v0, :cond_8

    .line 879
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mNotificationPulse:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0


That's it for SecSettings. Recompile and move on to SystemUI.
Attached Thumbnails
Click image for larger version

Name:	2013-03-12 16.41.50.jpg
Views:	3531
Size:	28.8 KB
ID:	1801252   Click image for larger version

Name:	2013-03-12 16.42.01.jpg
Views:	2400
Size:	27.3 KB
ID:	1801253  
Last edited by loserskater; 13th March 2013 at 09:10 AM.
The Following 26 Users Say Thank You to loserskater For This Useful Post: [ View ]
13th March 2013, 09:04 AM   |  #2  
loserskater's Avatar
OP Recognized Developer
Flag East Stroudsburg, PA
Thanks Meter: 3,318
 
1,851 posts
Join Date:Joined: Jun 2008
Donate to Me
More
SystemUI

Navigate to res/layout/tw_statusbar_expanded.xml
Modify the line in blue.
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">
    <FrameLayout 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/tw_notification_panel_header_height" layout="@layout/tw_status_bar_expanded_header" />
        <com.wanam.systemui.quickpanel.PowerWidget android:id="@id/exp_power_stat" android:layout_width="wrap_content" android:layout_height="@dimen/quick_setting_button_height" android:layout_marginTop="@dimen/tw_notification_panel_header_height" />
        <HorizontalScrollView android:id="@id/quicksetting_scroller" android:visibility="gone" android:scrollbars="none" android:layout_width="wrap_content" android:layout_height="@dimen/quick_setting_button_height" android:layout_marginTop="@dimen/tw_notification_panel_header_height">
            <com.android.systemui.statusbar.policy.quicksetting.QuickSettingPanel android:orientation="horizontal" android:id="@id/quicksetting_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:divider="@drawable/tw_black_bg" android:showDividers="middle" />
        </HorizontalScrollView>
        <ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginTop="@dimen/notification_panel_quicksettingbtn_height" android:overScrollMode="ifContentScrolls">
            <LinearLayout android:orientation="vertical" android:id="@id/scrollCart" android:layout_width="fill_parent" android:layout_height="wrap_content">
                    <LinearLayout android:orientation="vertical" android:id="@id/brightness_controller" android:background="#ff000000" android:visibility="visible" android:layout_width="fill_parent" android:layout_height="56.0dip">
                    <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="55.0dip">
                        <ImageView android:id="@id/brightness_icon" android:clickable="true" android:layout_width="25.0dip" android:layout_height="fill_parent" android:layout_marginLeft="13.0dip" android:src="@drawable/ic_sysbar_brightness" android:contentDescription="@string/accessibility_brightness_icon" />
                        <FrameLayout android:id="@id/brightness_group" android:layout_width="fill_parent" android:layout_height="fill_parent">
                            <com.android.systemui.statusbar.policy.ToggleSlider android:id="@id/brightness" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:text="@string/status_bar_settings_auto_brightness_label" />
                            <com.android.systemui.statusbar.policy.ToggleSlider android:id="@id/auto_brightness" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:text="@string/status_bar_settings_auto_brightness_label" />
                        </FrameLayout>
                    </LinearLayout>
                    <View android:background="#ff091a24" android:layout_width="fill_parent" android:layout_height="1.0dip" />
                </LinearLayout>
                <LinearLayout android:orientation="vertical" android:id="@id/noNotificationsTitle" android:focusable="true" android:layout_width="fill_parent" android:layout_height="wrap_content">
                    <TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textStyle="bold" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/noNotificationsText" android:paddingLeft="11.0dip" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height" android:text="@string/status_bar_no_notifications_title" />
                </LinearLayout>
                <LinearLayout android:orientation="vertical" android:id="@id/onGoingCart" android:background="#ff293945" android:focusable="true" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
                    <TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textStyle="bold" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/onGoingNotificationText" android:paddingLeft="11.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/status_bar_ongoing_events_title" />
                </LinearLayout>
                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/onGoingItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
                <LinearLayout android:orientation="vertical" android:id="@id/notificationCart" android:background="#ff293945" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
                    <RelativeLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
                        <TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textStyle="bold" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/latestNotificationText" android:paddingLeft="11.0dip" android:layout_width="180.0dip" android:layout_height="fill_parent" android:text="@string/status_bar_latest_events_title" android:layout_alignParentLeft="true" />
                        <TextView android:textSize="@dimen/status_bar_expanded_notification_clear_button_text_size" android:textColor="@color/tw_status_bar_clear_btn_text" android:gravity="center" android:id="@id/clear_all_button" android:background="@drawable/tw_btn_default_small" android:padding="0.100000024dip" android:focusable="true" android:clickable="true" android:layout_width="@dimen/status_bar_expanded_clear_button_width" android:layout_height="fill_parent" android:layout_marginRight="4.0dip" android:text="@string/status_bar_clear_all_button" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
                    </RelativeLayout>
                </LinearLayout>
                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/notificationItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
            </LinearLayout>
        </ScrollView>
    </FrameLayout>
    <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/tw_close_handle_height">
        <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
            <ImageView android:layout_gravity="bottom" android:layout_width="fill_parent" android:layout_height="@dimen/tw_close_handle_height" android:src="@drawable/tw_status_bar_close" android:scaleType="fitXY" />
            <TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network" android:gravity="center" android:layout_gravity="bottom" android:id="@id/carrier_label" android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_marginBottom="0.0dip" />
        </RelativeLayout>
    </com.android.systemui.statusbar.phone.CloseDragHandle>
</FrameLayout>


Next Navigate to smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali
Add the parts in red:
Code:
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BatteryTextObserver;,
        Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessSliderObserver;,
        Lcom/android/systemui/statusbar/phone/PhoneStatusBar$FastColorDrawable;,
        Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;,
        Lcom/android/systemui/statusbar/phone/PhoneStatusBar$NotificationClicker;,
        Lcom/android/systemui/statusbar/phone/PhoneStatusBar$H;,
        Lcom/android/systemui/statusbar/phone/PhoneStatusBar$ExpandedDialog;
    }
.end annotation


Code:
.field private mBatteryTextObserver:Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BatteryTextObserver;

.field mBrightness:Lcom/android/systemui/statusbar/policy/BrightnessController;

.field private mBrightnessSlider:Landroid/widget/LinearLayout;

.field private mBrightnessSliderObserver:Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessSliderObserver;

.field private mBroadcastReceiver:Landroid/content/BroadcastReceiver;

.field private mCallOnGoingView:Landroid/view/View;

.field private mCarrierLabel:Landroid/widget/TextView;


.method public constructor
Code:
    new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BatteryTextObserver;

    invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BatteryTextObserver;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

    iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryTextObserver:Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BatteryTextObserver;

    new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessSliderObserver;

    invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessSliderObserver;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

    iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBrightnessSliderObserver:Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessSliderObserver;

    .line 3912
    return-void
.end method


Add the following method in red:
Code:
.method static synthetic access$600(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)Lcom/android/systemui/statusbar/BaseStatusBar$H;
    .locals 1
    .parameter "x0"

    .prologue
    .line 154
    iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mHandler:Lcom/android/systemui/statusbar/BaseStatusBar$H;

    return-object v0
.end method

.method static synthetic access$6000(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)Landroid/widget/LinearLayout;
    .locals 1
    .parameter "x0"

    .prologue
    .line 154
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBrightnessSlider:Landroid/widget/LinearLayout;

    return-object v0
.end method

.method static synthetic access$700(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)Lcom/android/systemui/statusbar/BaseStatusBar$H;
    .locals 1
    .parameter "x0"

    .prologue
    .line 154
    iget-object v0, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mHandler:Lcom/android/systemui/statusbar/BaseStatusBar$H;

    return-object v0
.end method



.method protected makeStatusBarView
Add the parts in red:
NOTE: Make sure you look at this section. You have to match an ID from res/values/public.xml
Code:
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mScrollView:Landroid/widget/ScrollView;

    const/4 v10, 0x0

    invoke-virtual {v9, v10}, Landroid/widget/ScrollView;->setVerticalScrollBarEnabled(Z)V

    move-object/from16 v0, p0

    iget-object v9, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

    const v10, 0x7f0d011f

    invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

    move-result-object v9

    check-cast v9, Lcom/wanam/systemui/quickpanel/PowerWidget;

    move-object/from16 v0, p0

    iput-object v9, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/wanam/systemui/quickpanel/PowerWidget;

    iget-object v9, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

    const v10, 0x7f0d00e4  #Match with res/values/public.xml - brightness_controller

    invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->findViewById(I)Landroid/view/View;

    move-result-object v9

    check-cast v9, Landroid/widget/LinearLayout;

    iput-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBrightnessSlider:Landroid/widget/LinearLayout;

    iget-object v9, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;

    invoke-virtual {v9}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v9

    const-string v10, "display_brightness_slider"

    invoke-static {v10}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v10

    const/4 v11, 0x0

    iget-object v12, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBrightnessSliderObserver:Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessSliderObserver;

    invoke-virtual {v9, v10, v11, v12}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

    iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBrightnessSlider:Landroid/widget/LinearLayout;

    iget-object v9, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;

    invoke-virtual {v9}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v9

    const-string v11, "display_brightness_slider"

    const/4 v12, 0x0

    invoke-static {v9, v11, v12}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v9

    const/4 v11, 0x1

    if-ne v9, v11, :cond_bright

    const/4 v9, 0x0

    :goto_bright
    invoke-virtual {v10, v9}, Landroid/widget/LinearLayout;->setVisibility(I)V

    .line 735
    new-instance v9, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;

    iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarView:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;

    invoke-direct {v9, p0, v1, v10}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;Landroid/content/Context;Landroid/view/View;)V

    iput-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTicker:Lcom/android/systemui/statusbar/phone/Ticker;

    .line 737
    iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarView:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;

    const v10, 0x7f0d0040

    invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->findViewById(I)Landroid/view/View;

    move-result-object v8

    check-cast v8, Lcom/android/systemui/statusbar/phone/TickerView;


Code:
iget-object v9, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mPile:Lcom/android/systemui/statusbar/policy/NotificationRowLayout;

    iput-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedContents:Landroid/view/View;

    goto/16 :goto_5

    .line 730
    :cond_e
    const/4 v9, 0x4

    goto/16 :goto_6

    :cond_bright
    const/16 v9, 0x8

    goto/16 :goto_bright
    
    .line 762
    .restart local v8       #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
    :cond_f
    const/16 v9, 0x8

    goto/16 :goto_7

    .line 786
    .restart local v7       #signalCluster:Lcom/android/systemui/statusbar/SignalClusterView;
    :cond_10
    iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNetworkController:Lcom/android/systemui/statusbar/policy/NetworkController;

    iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mCarrierLabel:Landroid/widget/TextView;

    invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/policy/NetworkController;->addCombinedLabelView(Landroid/widget/TextView;)V

    goto/16 :goto_8


Now download the file attached and extract to smali/com/android/systemui/statusbar/phone

That's it recompile and test it out.
Attached Files
File Type: zip Brightness Slider Toggle.zip - [Click for QR Code] (3.5 KB, 533 views)
Last edited by loserskater; 13th March 2013 at 09:06 AM.
The Following 19 Users Say Thank You to loserskater For This Useful Post: [ View ]
13th March 2013, 10:36 AM   |  #3  
stratatak7's Avatar
Recognized Contributor / Swappa Representative
Flag Blacksburg, VA
Thanks Meter: 2,516
 
1,559 posts
Join Date:Joined: Jun 2011
Donate to Me
More
Re: [MOD][HOW-TO] Enable/disable brightness slider with toggle!
Remarkable work. Thanks so much for your contribution.

Sent from my SAMSUNG-SGH-I747 using xda premium
The Following User Says Thank You to stratatak7 For This Useful Post: [ View ]
13th March 2013, 03:17 PM   |  #4  
upndwn4par's Avatar
Recognized Developer
New Jersey
Thanks Meter: 9,829
 
3,598 posts
Join Date:Joined: Jan 2012
Donate to Me
7th !!!

Can you make me a flashable zip?

_______

Seriously though, very nice! Thanks for sharing.

Will be doing this soon....
The Following User Says Thank You to upndwn4par For This Useful Post: [ View ]
13th March 2013, 08:37 PM   |  #5  
Member
Flag new york
Thanks Meter: 5
 
99 posts
Join Date:Joined: Jan 2011
More
need help
i can not find the folder to exact that file to can some one tell where it is please and thank u
13th March 2013, 09:05 PM   |  #6  
enewman17's Avatar
Recognized Contributor
Flag Fort Wayne, IN
Thanks Meter: 6,699
 
2,787 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Re: [MOD][HOW-TO] Enable/disable brightness slider with toggle!
Quote:
Originally Posted by 315phatboi

i can not find the folder to exact that file to can some one tell where it is please and thank u

Not trying to insult you, please do not take this the wrong way. But if you need to ask that question then this thread is not for you. This will require editing smali, and xml. It is not a drag and drop type of mod.

Besides in the directions he had told you exactly where it goes.

Sent from my SAMSUNG-SGH-I747 using xda premium
The Following 4 Users Say Thank You to enewman17 For This Useful Post: [ View ]
13th March 2013, 11:10 PM   |  #7  
Idyar's Avatar
Senior Member
Flag Toronto
Thanks Meter: 390
 
564 posts
Join Date:Joined: Nov 2012
Donate to Me
More
You are the man I have had to build 2 systemui for every build this will save me a tonne of work.

Thanks again, I think our ROM is like 50% mods by you at this point lol.
The Following User Says Thank You to Idyar For This Useful Post: [ View ]
14th March 2013, 01:33 AM   |  #8  
Idyar's Avatar
Senior Member
Flag Toronto
Thanks Meter: 390
 
564 posts
Join Date:Joined: Nov 2012
Donate to Me
More
Quote:
Originally Posted by Idyar

You are the man I have had to build 2 systemui for every build this will save me a tonne of work.

Thanks again, I think our ROM is like 50% mods by you at this point lol.

Just wanted to add a silly mistake I made while putting this in. When searching for the correct value in public.xml make sure you use brightness_controller not brightness_controller_height (LOL) Took me like 15 mins to figure out haha.

Thanks again Loser, you are exactly the kind of person that makes this community great.
The Following User Says Thank You to Idyar For This Useful Post: [ View ]
14th March 2013, 03:40 AM   |  #9  
upndwn4par's Avatar
Recognized Developer
New Jersey
Thanks Meter: 9,829
 
3,598 posts
Join Date:Joined: Jan 2012
Donate to Me
If you are not using the 23 toggle mod, makeStatusBarView needs to look like this (add the code in red).


smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali

.method protected makeStatusBarView

Code:
.line 733
    iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mScrollView:Landroid/widget/ScrollView;

    const/4 v10, 0x0

    invoke-virtual {v9, v10}, Landroid/widget/ScrollView;->setVerticalScrollBarEnabled(Z)V

    iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/androidsystemustatusbar/phone/StatusBarWindowView;

    const v10, 0x7f0d00e4  #Match with res/values/public.xml - brightness_controller

    invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->findViewById(I)Landroid/view/View;

    move-result-object v9

    check-cast v9, Landroid/widget/LinearLayout;

    iput-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBrightnessSlider:Landroid/widget/LinearLayout;

    iget-object v9, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;

    invoke-virtual {v9}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v9

    const-string v10, "display_brightness_slider"

    invoke-static {v10}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v10

    const/4 v11, 0x0

    iget-object v12, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBrightnessSliderObserver:Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessSliderObserver;

    invoke-virtual {v9, v10, v11, v12}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

    iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBrightnessSlider:Landroid/widget/LinearLayout;

    iget-object v9, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;

    invoke-virtual {v9}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v9

    const-string v11, "display_brightness_slider"

    const/4 v12, 0x0

    invoke-static {v9, v11, v12}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v9

    const/4 v11, 0x1

    if-ne v9, v11, :cond_bright

    const/4 v9, 0x0

    :goto_bright
    invoke-virtual {v10, v9}, Landroid/widget/LinearLayout;->setVisibility(I)V
	
    .line 735
    new-instance v9, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;

    iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarView:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;

    invoke-direct {v9, p0, v1, v10}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;Landroid/content/Context;Landroid/view/View;)V
The Following 4 Users Say Thank You to upndwn4par For This Useful Post: [ View ]
14th March 2013, 04:10 AM   |  #10  
enewman17's Avatar
Recognized Contributor
Flag Fort Wayne, IN
Thanks Meter: 6,699
 
2,787 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Re: [MOD][HOW-TO] Enable/disable brightness slider with toggle!
This was a doosy, but this really makes a perfect edition to total customization. I love this along with Didact74 battery mod. You've made so many happy with your work. And I'm so proud of myself I actually got it right the first time. I'm grinning ear to ear man. I'm starting to understand the language better. Still a ways off from doing something like this myself but one mod at a time right.

Sent from my SAMSUNG-SGH-I747 using xda premium

The Following User Says Thank You to enewman17 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