Happy Easter!
What does this MOD do?
It will allow you to change the status bar transparency settings without the need to reboot.
This will also be included as part of the Multi-Mod update coming shortly.
The attached zip is not flashable, its a file that's needed for the mod. A flashable zip will be added soon in the form of a link, not an attachment.
We will be working with two files:
SecSettings
SystemUI
As usual, I will assume you are using Rom Control for you settings controls. If not, you can port this to whichever settings header you prefer but I will not be going over how to do that here. I created Rom Control to eliminate the time needed to do all that.
There will be a zip included with a file that needs to be added to SystemUI. This is not a flashable zip. The file will need to be dropped in:
smali/com/android/systemui/statusbar/phone
Lets begin with SecSettings....
Navigate to res/xml/rom_settings.xml
Add the following code in RED
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/rom_settings"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings.didact">
<PreferenceCategory android:title="@string/rom_settings_section_one_title" />
<ListPreference android:persistent="true" android:entries="@array/lockscreen_entries" android:title="Choose Your LockScreen" android:key="lockscreen_type_key" android:defaultValue="1" android:entryValues="@array/lockscreen_values" />
<CheckBoxPreference android:title="@string/enable_lockscreen_torch" android:key="enable_lockscreen_torch" android:summary="@string/enable_lockscreen_torch_text" />
<CheckBoxPreference android:title="@string/enable_aosp_vibrate" android:key="aosp_vibrate" android:summary="@string/enable_aosp_vibrate_text" />
<PreferenceCategory android:title="@string/rom_settings_section_two_title" />
<ListPreference android:entries="@array/clock_style_entries" android:title="@string/clock_title_enable" android:key="clock_style" android:entryValues="@array/clock_style_values" />
<ListPreference android:entries="@array/clock_ampm_entries" android:title="@string/title_clock_ampm_entries" android:key="clock_am_pm_style" android:entryValues="@array/clock_ampm_values" />
<ListPreference android:entries="@array/clock_weekday_entries" android:title="@string/enable_clock_weekday" android:key="clock_weekday" android:summary="@string/enable_clock_weekday_summary" android:entryValues="@array/clock_weekday_values" />
<PreferenceCategory android:title="@string/rom_settings_section_three_title" />
<ListPreference android:entries="@array/battery_icon_entries" android:title="@string/battery_icon" android:key="battery_icon_list" android:entryValues="@array/battery_icon_values" />
<PreferenceCategory android:title="@string/rom_settings_section_four_title" />
<CheckBoxPreference android:title="@string/enable_ime_icon" android:key="enable_ime_icon" android:summary="@string/enable_ime_icon_text" />
<CheckBoxPreference android:persistent="false" android:title="@string/long_press_volume_title" android:key="music_control" android:summary="@string/long_press_volume_summary" />
<CheckBoxPreference android:title="@string/crtanimation_title" android:key="crtanimation_toggle" android:summary="@string/crtanimation_summary" />
[COLOR="red"]<ListPreference android:entries="@array/entries_status_bar_transparency" android:title="@string/status_bar_transparency_title" android:key="status_bar_transparency" android:summary="@string/status_bar_transparency_summary" android:defaultValue="0" android:entryValues="@array/values_status_bar_transparency" />
</PreferenceScreen>[/COLOR]
Add the following code
Code:
<string-array name="entries_status_bar_transparency">
<item>0%</item>
<item>50%</item>
<item>100%</item>
</string-array>
<string-array name="values_status_bar_transparency">
<item>100</item>
<item>75</item>
<item>50</item>
</string-array>
Add the following code...
Code:
<string name="status_bar_transparency_title">Statusbar Transparency</string>
<string name="status_bar_transparency_summary">Adjust statusbar transparency</string>
Add the following code in RED
Code:
# instance fields
.field mBatteryIcon:Landroid/preference/ListPreference;
.field mBatteryStyle:Landroid/preference/ListPreference;
.field mClockAmPmstyle:Landroid/preference/ListPreference;
.field mClockStyle:Landroid/preference/ListPreference;
.field mClockWeekday:Landroid/preference/ListPreference;
.field mCrtAnimationPreference:Landroid/preference/CheckBoxPreference;
.field mImeIcon:Landroid/preference/CheckBoxPreference;
.field mLockScreenStylePref:Landroid/preference/ListPreference;
.field mLockScreenTorch:Landroid/preference/CheckBoxPreference;
.field mMusicControl:Landroid/preference/CheckBoxPreference;
.field mAospLockVibration:Landroid/preference/CheckBoxPreference;
[COLOR="red"].field mStatusbarTransparency:Landroid/preference/ListPreference;
[/COLOR]
Add the following code in RED
Code:
const-string v5, "lockscreen_type_key"
invoke-static {v4, v5, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
invoke-static {v4}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;
move-result-object v4
invoke-virtual {v1, v4}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
[COLOR="red"]const-string v1, "status_bar_transparency"
invoke-virtual {p0, v1}, Lcom/android/settings/didact/RomSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
check-cast v1, Landroid/preference/ListPreference;
iput-object v1, p0, Lcom/android/settings/didact/RomSettings;->mStatusbarTransparency:Landroid/preference/ListPreference;
iget-object v1, p0, Lcom/android/settings/didact/RomSettings;->mStatusbarTransparency:Landroid/preference/ListPreference;
invoke-virtual {v1, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
iget-object v1, p0, Lcom/android/settings/didact/RomSettings;->mStatusbarTransparency:Landroid/preference/ListPreference;
invoke-virtual {p0}, Lcom/android/settings/didact/RomSettings;->getActivity()Landroid/app/Activity;
move-result-object v4
invoke-virtual {v4}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v5, "status_bar_transparency"
invoke-static {v4, v5, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
invoke-static {v4}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;
move-result-object v4
invoke-virtual {v1, v4}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
[/COLOR]
const-string v1, "enable_lockscreen_torch"
invoke-virtual {p0, v1}, Lcom/android/settings/didact/RomSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
check-cast v1, Landroid/preference/CheckBoxPreference;
Add the following code in RED
Code:
:cond_4
iget-object v5, p0, Lcom/android/settings/didact/RomSettings;->mLockScreenStylePref:Landroid/preference/ListPreference;
if-ne p1, v5, [COLOR="red"]:cond_6[/COLOR]
check-cast p2, Ljava/lang/String;
invoke-static {p2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result v4
invoke-virtual {p0}, Lcom/android/settings/didact/RomSettings;->getActivity()Landroid/app/Activity;
move-result-object v5
invoke-virtual {v5}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
if-eqz v5, :cond_5
const-string v6, "lockscreen_ripple_effect"
const/4 v2, 0x0
invoke-static {v5, v6, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
const-string v6, "lockscreen_type_key"
invoke-static {v5, v6, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto :goto_0
:cond_5
const-string v6, "lockscreen_type_key"
invoke-static {v5, v6, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
const/4 v2, 0x1
const-string v6, "lockscreen_ripple_effect"
invoke-static {v5, v6, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto :goto_0
[COLOR="red"]:cond_6
iget-object v5, p0, Lcom/android/settings/didact/RomSettings;->mStatusbarTransparency:Landroid/preference/ListPreference;
if-ne p1, v5, :cond_0
check-cast p2, Ljava/lang/String;
invoke-static {p2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result v4
invoke-virtual {p0}, Lcom/android/settings/didact/RomSettings;->getActivity()Landroid/app/Activity;
move-result-object v5
invoke-virtual {v5}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
const-string v6, "status_bar_transparency"
invoke-static {v5, v6, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
move-result v2
goto :goto_0
[/COLOR].end method
Lets move on to SystemUI...
Open the attached zip and drop the observer file in smali/com/android/systemui/statusbar/phone if you have not already done so.
Navigate to smali/com/android/systemui/statusbar/BaseStatusbar.smali
Find the following method "setAreThereNotifications()V"
Add the following complete method directly after...
Code:
.method protected setStatusBarParams(Landroid/view/View;)V
.locals 4
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "status_bar_transparency"
const/16 v3, 0x64
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
invoke-virtual {p1}, Landroid/view/View;->getBackground()Landroid/graphics/drawable/Drawable;
move-result-object v1
mul-int/lit16 v2, v0, 0xff
div-int/lit8 v2, v2, 0x64
int-to-float v2, v2
invoke-static {v2}, Ljava/lang/Math;->round(F)I
move-result v2
invoke-virtual {v1, v2}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V
return-void
.end method
Add the following code in RED
Code:
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessEnableObserver;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BatteryTextObserver;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$FastColorDrawable;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;,
[COLOR="red"]Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;,[/COLOR]
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$NotificationClicker;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$H;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$ExpandedDialog;
Towards the end of this method, add the following code in RED
Code:
invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/policy/NotificationRowLayout;->setLongPressListener(Landroid/view/View$OnLongClickListener;)V
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;
[COLOR="red"]new-instance v9, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;
new-instance v10, Landroid/os/Handler;
invoke-direct {v10}, Landroid/os/Handler;-><init>()V
invoke-direct {v9, p0, v10}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;Landroid/os/Handler;)V
invoke-virtual {v9}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->observe()V
[/COLOR]
goto/16 :goto_5
:cond_f
const/16 v9, 0x8
goto/16 :goto_6
Towards the end of that method add the following code in RED
Code:
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mWindowManager:Landroid/view/IWindowManager;
invoke-super {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->start()V
invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->addNavigationBar()V
[COLOR="red"]new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mHandler:Lcom/android/systemui/statusbar/BaseStatusBar$H;
invoke-direct {v0, p0, v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;Landroid/os/Handler;)V
invoke-virtual {v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->observe()V
[/COLOR]
new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;
iget-object v1, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-direct {v0, v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;-><init>(Landroid/content/Context;)V
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mIconPolicy:Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;
return-void
.end method
Multi-Mod Flashable Add-On
I will be adding this MOD to the new Multi-Mod update shortly.
I will add a flashable zip to this thread that will allow you to add this to my Multi-Mod if you are currently running it.
Hit the thanks....buy me a coke!
Attachments
-
1.1 KB Views: 766
Last edited: