Quantcast
Channel: xda-developers - AT&T Galaxy S III Android Development
Viewing all articles
Browse latest Browse all 285

[MOD][HOW-TO] Real-time notification panel background color/transparency

$
0
0
This will allow you to change the background color/transparency of the notification panel in real time without rebooting.

We're going to be working with the following two files:
SecSettings.apk
SystemUI.apk



KEY
REMOVE what's in BLUE
ADD what's in RED


Note:
If you've already implemented my Clock mod and added the color picker files, you'll have to replace it with what I've attached as I've changed how the color picker works. It now saves your setting instead of reverting it to default everytime you leave and come back to the menu. I'll be updating the clock mod right now.

Issues:
There is a tiny line that goes across just under the brightness slider/notification toggles that I cannot figure out how to remove. It's only noticeable when you use colors. If you're just using transparency then it's hard to tell.

SecSettings.apk
 
Navigate to /res/values/strings.xml
Add the following to the end of the file
 
Code:

    <string name="notification_panel_color_title">Notification panel color</string>
    <string name="notification_panel_color_summary">Change the background color of the notification panel</string>
    <string name="dialog_color_picker">Color Picker</string>
    <string name="press_color_to_apply">Press on Color to apply</string>


Navigate to /res/values/ids.xml
add the following to the end of the file
 
Code:

    <item type="id" name="color_picker_view">false</item>
    <item type="id" name="old_color_panel">false</item>
    <item type="id" name="new_color_panel">false</item>


Navigate to /xml/display_settings.xml
Add the following line wherever you would like it to show in the menu
 
Code:

    <com.loser.colorpicker.ColorPickerPreference android:persistent="false" android:title="@string/notification_panel_color_title" android:key="notification_panel_color" android:summary="@string/notification_panel_color_summary" android:defaultValue="0xff000000" alphaSlider="true" />


Navigate to /smali/com/android/settings/DisplaySettings.smali
 
Code:

.field private mMultiWindowModeObserver:Landroid/database/ContentObserver;

.field private mMultiWindowPref:Landroid/preference/CheckBoxPreference;

.field private mNotificationPanelColor:Lcom/loser/colorpicker/ColorPickerPreference;

.field private mNotificationPulse:Landroid/preference/CheckBoxPreference;

.field private mPowerSavingMode:Landroid/preference/CheckBoxPreference;



.method private updateState()V
 
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_4

    move v0, v1

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

    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mNotificationPanelColor:Lcom/loser/colorpicker/ColorPickerPreference;

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

    move-result-object v3

    const-string v4, "notification_panel_color"

    const v5, -0xffffff

    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/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    const/16 v5, 0x0

    invoke-virtual {v0, v5, v3}, Lcom/loser/colorpicker/ColorPickerPreference;->onSetInitialValue(ZLjava/lang/Object;)V


    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"



.method public onCreate(Landroid/os/Bundle;)V
 
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, "notification_panel_color"

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

    move-result-object v11

    check-cast v11, Lcom/loser/colorpicker/ColorPickerPreference;

    iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mNotificationPanelColor:Lcom/loser/colorpicker/ColorPickerPreference;

    iget-object v11, p0, Lcom/android/settings/DisplaySettings;->mNotificationPanelColor:Lcom/loser/colorpicker/ColorPickerPreference;

    invoke-virtual {v11, p0}, Lcom/loser/colorpicker/ColorPickerPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V


    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 onPreferenceChange(Landroid/preference/Preference;Ljava/lang/Object;)Z
 
Code:

    :catch_2
    move-exception v0

    .line 1038
    const-string v1, "DisplaySettings"

    const-string v2, "could not persist Touch key light setting"

    invoke-static {v1, v2, v0}, Landroid/util/Log;->secE(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_4

    .line 1040
    :cond_9
    const-string v2, "notification_panel_color"

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

    move-result v2

    if-eqz v2, :cond_next

    invoke-static {p2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    const-string v1, "^#"

    const-string v3, ""

    invoke-virtual {v2, v1, v3}, Ljava/lang/String;->replaceFirst(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

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

    move-result v1

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

    move-result-object v2

    const-string v3, "notification_panel_color"

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

    goto/16 :goto_4

    :cond_next

    const-string v2, "quick_launch"

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

    move-result v2



Now download the attached zip and extract to the root of your SecSettings folder.
Compile and then decompile and open up /res/values/public.xml
Open /smali/com/loser/colorpicker/ColorPickerDialog.smali
There should be a total of 6 id's you need to get. Make sure you're looking at the type as there's a layout and string with the same name.


That's it for SecSettings. Compile.


Viewing all articles
Browse latest Browse all 285

Trending Articles