为Android2.3添加下拉通知栏的快捷开关

 

对于2.3的rom而言,应该修改SystemUI.apk

修改过程如下:

1、添加相关图片。

2、res\layout\文件夹下添加quickpanel_quick_settings.xml文件

3、在res\values\strings.xml里添加值:


<string name="quickpanel_wifi_text">Wi-Fi</string>
<string name="quickpanel_bluetooth_text">Bluetooth</string>
<string name="quickpanel_gps_text">GPS</string>
<string name="quickpanel_sound_text">Sound</string>
<string name="quickpanel_sound_vibration_text">"SoundVibration"</string>
<string name="quickpanel_silent_text">Silent</string>
<string name="quickpanel_vibration_text">Vibration</string>
<string name="quickpanel_error_text">Error</string>
<string name="quickpanel_data_text">Data</string>

在res\values-zh-rCN\strings.xml里添加值:

<string name="quickpanel_bluetooth_text">蓝牙</string>
<string name="quickpanel_sound_text">声音</string>
<string name="quickpanel_sound_vibration_text">声音振动</string>
<string name="quickpanel_silent_text">静音</string>
<string name="quickpanel_vibration_text">振动</string>
<string name="quickpanel_error_text">错误</string>
<string name="quickpanel_data_text">数据</string>

4、在res\values\ids.xml里加入以下代码:

<item type="id" name="quickpanel_quick_settings">false</item>
<item type="id" name="quickpanel_wifi_btn_icon">false</item>
<item type="id" name="quickpanel_wifi_btn_text">false</item>
<item type="id" name="quickpanel_wifi_btn_status_icon">false</item>
<item type="id" name="quickpanel_bt_btn_icon">false</item>
<item type="id" name="quickpanel_bt_btn_text">false</item>
<item type="id" name="quickpanel_bt_btn_status_icon">false</item>
<item type="id" name="quickpanel_gps_btn_icon">false</item>
<item type="id" name="quickpanel_gps_btn_text">false</item>
<item type="id" name="quickpanel_gps_btn_status_icon">false</item>
<item type="id" name="quickpanel_sound_btn_icon">false</item>
<item type="id" name="quickpanel_sound_btn_text">false</item>
<item type="id" name="quickpanel_sound_btn_status_icon">false</item>
<item type="id" name="quickpanel_data_btn_icon">false</item>
<item type="id" name="quickpanel_data_btn_text">false</item>
<item type="id" name="quickpanel_data_btn_status_icon">false</item>


5、在mali\com\android\systemui\statusbar\文件夹下添加quickpanel文件夹,并修改16进制数值所对应的新id。

6、在smali\com\android\systemui\R$drawable.smali加入:(排序方式为英语字母)

此处定义的是19个图标文件

.field public static final quickpanel_icon_bluetooth_ing:I = 0x7f0200e7
.field public static final quickpanel_icon_bluetooth_off:I = 0x7f0200e8
.field public static final quickpanel_icon_bluetooth_on:I = 0x7f0200e9
.field public static final quickpanel_icon_gps_off:I = 0x7f0200ea
.field public static final quickpanel_icon_gps_on:I = 0x7f0200eb
.field public static final quickpanel_icon_ing:I = 0x7f0200ec
.field public static final quickpanel_icon_off:I = 0x7f0200ed
.field public static final quickpanel_icon_on:I = 0x7f0200ee
.field public static final quickpanel_icon_rotation_off:I = 0x7f0200ef
.field public static final quickpanel_icon_rotation_on:I = 0x7f0200f0
.field public static final quickpanel_icon_silent_off:I = 0x7f0200f1
.field public static final quickpanel_icon_sound_on_on:I = 0x7f0200f2
.field public static final quickpanel_icon_sound_vibration_on:I = 0x7f0200f3
.field public static final quickpanel_icon_vibration_off:I = 0x7f0200f4
.field public static final quickpanel_icon_wifi_ing:I = 0x7f0200f5
.field public static final quickpanel_icon_wifi_off:I = 0x7f0200f6
.field public static final quickpanel_icon_wifi_on:I = 0x7f0200f7
.field public static final quickpanel_quick_settings_background:I = 0x7f0200f8
.field public static final quickpanel_title_background:I = 0x7f0200f9

7、smali\com\android\systemui\R$id.smali中加入\res\values\ids.xml中加入的新id

.field public static final quickpanel_quick_settings:I = 0x7f090016
.field public static final quickpanel_wifi_btn_icon:I = 0x7f090017
.field public static final quickpanel_wifi_btn_text:I = 0x7f090018
.field public static final quickpanel_wifi_btn_status_icon:I = 0x7f090019
.field public static final quickpanel_bt_btn_icon:I = 0x7f09001a
.field public static final quickpanel_bt_btn_text:I = 0x7f09001b
.field public static final quickpanel_bt_btn_status_icon:I = 0x7f09001c
.field public static final quickpanel_gps_btn_icon:I = 0x7f09001d
.field public static final quickpanel_gps_btn_text:I = 0x7f09001e
.field public static final quickpanel_gps_btn_status_icon:I = 0x7f09001f
.field public static final quickpanel_sound_btn_icon:I = 0x7f090020
.field public static final quickpanel_sound_btn_text:I = 0x7f09001
.field public static final quickpanel_sound_btn_status_icon:I = 0x7f09002
.field public static final quickpanel_data_btn_icon:I = 0x7f09003
.field public static final quickpanel_data_btn_text:I = 0x7f09004
.field public static final quickpanel_data_btn_status_icon:I = 0x7f09005


7、smali\com\android\systemui\R$layout.smali中加入\res\layout中新加入的quickpanel_quick_settings.xml所对应的16进制id

.field public static final quickpanel_quick_settings:I = 0x7f030006



8、smali\com\android\systemui\R$string.smali中加入\res\values\string.xml中新加入的新id所对应的id值

.field public static final quickpanel_wifi_text:I = 0x7f070010
.field public static final quickpanel_bluetooth_text:I = 0x7f070011
.field public static final quickpanel_gps_text:I = 0x7f070012
.field public static final quickpanel_sound_text:I = 0x7f070013
.field public static final quickpanel_sound_vibration_text:I = 0x7f070014
.field public static final quickpanel_silent_text:I = 0x7f070015
.field public static final quickpanel_vibration_text:I = 0x7f070016
.field public static final quickpanel_error_text:I = 0x7f070017
.field public static final quickpanel_data_text:I = 0x7f070018


9、smali\com\android\systemui\statusbar\StatusBarService.smali中找到如下代码:

iget-object v6, p0, Lcom/android/systemui/statusbar/StatusBarService;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

invoke-virtual {p1, v6, v2}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

.line 327
return-void
.end method



修改为:

iget-object v6, p0, Lcom/android/systemui/statusbar/StatusBarService;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

invoke-virtual {p1, v6, v2}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

const v6, 0x7f030006

const/4 v9, 0x0

invoke-static {p1, v6, v9}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

move-result-object v5

check-cast v5, Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;

.local v5, qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
iget-object v6, p0, Lcom/android/systemui/statusbar/StatusBarService;->mExpandedView:Lcom/android/systemui/statusbar/ExpandedView;

const/4 v2, 0x0

invoke-virtual {v6, v5, v2}, Lcom/android/systemui/statusbar/ExpandedView;->addView(Landroid/view/View;I)V

return-void
.end method


上面0x7f030006为\res\layout\quickpanel_quick_settings.xml所对应的16进制id

如要修改相关透明,也可修改如下代码:

.local v7, view:Lcom/android/systemui/statusbar/StatusBarView;
new-instance v0, Landroid/view/WindowManager$LayoutParams;

const/4 v1, -0x1

const/16 v3, 0x7d0

const/16 v4, 0x48

const/4 v5, 0x2


改为:

.local v7, view:Lcom/android/systemui/statusbar/StatusBarView;
new-instance v0, Landroid/view/WindowManager$LayoutParams;

const/4 v1, -0x1

const/16 v3, 0x7d0

const/16 v4, 0x48

const/4 v5, -0x3


这是修改状态栏背景透明,要修改状态栏透明的时候这是必改项!

找到:

.line 1207
const/4 v5, 0x2


修改为:

.line 1207
const/4 v5, -0x3


这是下拉菜单快捷按钮背景透明。


10、编译,并解出classes.dex、resources.arsc、quickpanel_quick_settings.xml和相关图片,放入SystemUI.apk中。

你可能感兴趣的:(android,android,String,String,layout,BT)