首页 > 代码库 > 通知栏快捷按钮自定义教程以及快捷面板提取的思路-转自魔趣论坛-lonyii2
通知栏快捷按钮自定义教程以及快捷面板提取的思路-转自魔趣论坛-lonyii2
原帖地址:
http://bbs.mfunz.com/forum.php?mod=viewthread&tid=235198&extra=page%3D1%26filter%3Dtypeid%26typeid%3D899%26typeid%3D899
反编译、重编译这是基本功
要修改的APK: system/app/SystemUI.apk
第一部分 ----简单自定义
反编译后用Notepad++打开res/layout/lonyii_quick_settings.xml,
小猪版的打开res/layout/xiaozhu_zhu_settings.xml,
节选三个按钮的布局代码:
第一段:WIFI,看<FrameLayout android:id=”@id/lonyii_wifi_btn”这句,,id=xxxxxwifixxxxx
<FrameLayout android:id=”@id/lonyii_wifi_btn” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:layout_weight=”1.0″>
<ImageView android:layout_gravity=”center_horizontal” android:id=”@id/lonyii_wifi_btn_icon” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_marginTop=”2.669983dip” android:src=http://www.mamicode.com/”@drawable/akt_lonyii_icon_wifi_off” />
<com.android.systemui.statusbar.lonyii.WifiSettingButton android:textSize=”1.0dip” android:textStyle=”normal” android:textColor=”#ffffffff” android:gravity=”center_horizontal” android:id=”@id/lonyii_wifi_btn_text” android:paddingTop=”0.0dip” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:text=”@string/lonyii_wifi_text” android:shadowDx=”1.0″ android:shadowDy=”1.0″ />
<ImageView android:layout_gravity=”bottom|center” android:id=”@id/lonyii_wifi_btn_status_icon” android:paddingLeft=”0.0dip” android:paddingRight=”0.0dip” android:layout_width=”fill_parent” android:layout_height=”8.0dip” android:layout_marginBottom=”0.0dip” android:src=http://www.mamicode.com/”@drawable/akt_lonyii_icon_off” android:scaleType=”fitXY” />
</FrameLayout>
第二段:蓝牙,<FrameLayout android:id=”@id/lonyii_bt_btn” ------->bt=bluetooth
<FrameLayout android:id=”@id/lonyii_bt_btn” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:layout_weight=”1.0″ android:layout_toRightOf=”@id/lonyii_wifi_btn”>
<ImageView android:layout_gravity=”center_horizontal” android:id=”@id/lonyii_bt_btn_icon” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_marginTop=”2.669983dip” android:src=http://www.mamicode.com/”@drawable/akt_lonyii_icon_bluetooth_off” />
<com.android.systemui.statusbar.lonyii.BluetoothSettingButton android:textSize=”1.0dip” android:textStyle=”normal” android:textColor=”#ffffffff” android:gravity=”center_horizontal” android:id=”@id/lonyii_bt_btn_text” android:paddingTop=”0.0dip” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:text=”@string/lonyii_bluetooth_text” android:shadowDx=”1.0″ android:shadowDy=”1.0″ />
<ImageView android:layout_gravity=”bottom|center” android:id=”@id/lonyii_bt_btn_status_icon” android:paddingLeft=”0.0dip” android:paddingRight=”0.0dip” android:layout_width=”fill_parent” android:layout_height=”8.0dip” android:layout_marginBottom=”0.0dip” android:src=http://www.mamicode.com/”@drawable/akt_lonyii_icon_off” android:scaleType=”fitXY” />
</FrameLayout>
复制代码
第三段:GPS
<FrameLayout android:id="@id/lonyii_gps_btn" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_toRightOf="@id/lonyii_bt_btn">
<ImageView android:layout_gravity="center_horizontal" android:id="@id/lonyii_gps_btn_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2.669983dip" android:src="http://www.mamicode.com/@drawable/akt_lonyii_icon_gps_off" />
<com.android.systemui.statusbar.lonyii.GpsSettingButton android:textSize="1.0dip" android:textStyle="normal" android:textColor="#ffffffff" android:gravity="center_horizontal" android:id="@id/lonyii_gps_btn_text" android:paddingTop="0.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/lonyii_gps_text" android:shadowDx="1.0" android:shadowDy="1.0" />
<ImageView android:layout_gravity="bottom|center" android:id="@id/lonyii_gps_btn_status_icon" android:paddingLeft="0.0dip" android:paddingRight="0.0dip" android:layout_width="fill_parent" android:layout_height="8.0dip" android:layout_marginBottom="0.0dip" android:src="http://www.mamicode.com/@drawable/akt_lonyii_icon_off" android:scaleType="fitXY" />
</FrameLayout>
复制代码
记住3点就行:
1.从<FrameLayout>到</FrameLayout>是一个按钮的布局代码;
2.<FrameLayout>里面的属性 android:id="@id/lonyii_gps_btn" 表示 这是一个什么按钮,这条就是指GPS;
3.<FrameLayout>里面的另一个属性android:layout_toRightOf表示这个按钮在哪个按钮的右边,android:layout_toRightOf="@id/lonyii_bt_btn"就是表示其在蓝牙按钮的右边,调换顺序及删除按钮的时候要注意修改成对应的ID。
.删除某个按扭
1.先删除某个按钮的代码块,即从<FrameLayout>到</FrameLayout>
2.修改已删除按钮右侧的android:layout_toRightOf按钮属性,比如删除了蓝牙按钮,就得修改它右侧的,即GPS,把这句android:layout_toRightOf="@id/lonyii_bt_btn"改成android:layout_toRightOf="@id/lonyii_wifi_btn",因为你删除了蓝牙,GPS左侧按钮就应该是WIFI了,
.调换按钮顺序
1.直接修改android:layout_toRightOf属性就行,最好也能换一下按钮代码块的顺序,以便自己阅读,不然到时自己都凌乱了,
2.比如把GPS和蓝牙互换,蓝牙代码块的android:layout_toRightOf="@id/lonyii_wifi_btn"属性就要改成android:layout_toRightOf="@id/lonyii_gps_btn",因为互换后其在GPS右侧了;GPS代码块的android:layout_toRightOf="@id/lonyii_bt_btn"就要改成android:layout_toRightOf="@id/lonyii_wifi_btn",因为互换后GPS是在WIFI右侧。
.替换图片
不用反编译,用WINRAR打开SystemUI.apk,找到对应的按钮图片,弄个自己喜欢的图片替换压缩进去再弄进手机就可以了
第二部分 ----通知栏添加快捷按钮的思路
其实思路很简单的,把相关的东西提取出来就OK了,具体分为四大块:
1.相关图片
2.smali代码文件夹
3.布局文件
4.获取public.xml里面的新ID后修改SMALI里面关联的资源ID
下面以LONYII版本为例,
提取的思路是
反编译SystemUI.apk
因为要在通知栏加东西,必然要修改通知栏的布局文件即status_bar_expanded.xml
打开status_bar_expanded.xml即可找到快捷按钮的关键句<include layout="@layout/lonyii_quick_settings" />,就是说在这个地方包含/插入lonyii_quick_settings.xml这个布局文件
再转到lonyii_quick_settings.xml就可以看到这个代码块<com.android.systemui.statusbar.lonyii.QuickSettingsView>,即调用smali/com/android/systemui/statusbar/lonyii/quicksettingsview.smali这个程序
不难发现存在如下文件夹 ----lonyii
这个lonyii目录就正是我们要提取的第2块,快捷面板的主程序都在这里了
直接整个文件夹复制吧,备用
-------------------------------------------------------
下一步就是提取图片了,图片文件在SystemUI\res\drawable-hdpi,快捷面板的图片文件名都很有规律的,不管是CM7版还是ArgenSoft(LONYII及小猪版就是从此提取)都很规律,以LONYII版为例,要提取的有以下文件:
akt_lonyii_icon_bluetooth_ing.png
akt_lonyii_icon_bluetooth_off.png
akt_lonyii_icon_bluetooth_on.png
akt_lonyii_icon_brightness_off.png
akt_lonyii_icon_brightness_on.png
akt_lonyii_icon_gps_off.png
akt_lonyii_icon_gps_on.png
akt_lonyii_icon_ing.png
akt_lonyii_icon_mobile_data_off.png
akt_lonyii_icon_mobile_data_on.png
akt_lonyii_icon_off.png
akt_lonyii_icon_on.png
akt_lonyii_icon_rotation_off.png
akt_lonyii_icon_rotation_on.png
akt_lonyii_icon_silent_off.png
akt_lonyii_icon_sound_on_on.png
akt_lonyii_icon_sound_vibration_on.png
akt_lonyii_icon_vibration_off.png
akt_lonyii_icon_wifi_ing.png
akt_lonyii_icon_wifi_off.png
akt_lonyii_icon_wifi_on.png
akt_lonyii_quick_settings_background.png
akt_lonyii_title_background.9.png
akt_quick_panel_icon_flight_mode_off.png
akt_quick_panel_icon_flight_mode_on.png
akt_quick_panel_icon_sync_mode_off.png
akt_quick_panel_icon_sync_mode_on.png
lonyii_icon_shutdown.png
复制出来,备用,图片部分搞定
-------------------------------------------------------
接下来就是XML部分的提取,有strings、ids和layout三部分,要提取哪些可以看public.xml里面有哪些相关的东西,过滤了一下可以看到关于快捷面板的有以下东西:
:书签1
<public type="drawable" name="akt_lonyii_icon_bluetooth_ing" id="0x7f0200e5" />
<public type="drawable" name="akt_lonyii_icon_bluetooth_off" id="0x7f0200e6" />
<public type="drawable" name="akt_lonyii_icon_bluetooth_on" id="0x7f0200e7" />
<public type="drawable" name="akt_lonyii_icon_gps_off" id="0x7f0200e8" />
<public type="drawable" name="akt_lonyii_icon_gps_on" id="0x7f0200e9" />
<public type="drawable" name="akt_lonyii_icon_ing" id="0x7f0200ea" />
<public type="drawable" name="akt_lonyii_icon_mobile_data_off" id="0x7f0200eb" />
<public type="drawable" name="akt_lonyii_icon_mobile_data_on" id="0x7f0200ec" />
<public type="drawable" name="akt_lonyii_icon_off" id="0x7f0200ed" />
<public type="drawable" name="akt_lonyii_icon_on" id="0x7f0200ee" />
<public type="drawable" name="akt_lonyii_icon_rotation_off" id="0x7f0200ef" />
<public type="drawable" name="akt_lonyii_icon_rotation_on" id="0x7f0200f0" />
<public type="drawable" name="akt_lonyii_icon_silent_off" id="0x7f0200f1" />
<public type="drawable" name="akt_lonyii_icon_sound_on_on" id="0x7f0200f2" />
<public type="drawable" name="akt_lonyii_icon_sound_vibration_on" id="0x7f0200f3" />
<public type="drawable" name="akt_lonyii_icon_vibration_off" id="0x7f0200f4" />
<public type="drawable" name="akt_lonyii_icon_wifi_ing" id="0x7f0200f5" />
<public type="drawable" name="akt_lonyii_icon_wifi_off" id="0x7f0200f6" />
<public type="drawable" name="akt_lonyii_icon_wifi_on" id="0x7f0200f7" />
<public type="drawable" name="akt_lonyii_quick_settings_background" id="0x7f0200f8" />
<public type="drawable" name="akt_lonyii_title_background" id="0x7f0200f9" />
<public type="drawable" name="akt_quick_panel_icon_flight_mode_off" id="0x7f0200fa" />
<public type="drawable" name="akt_quick_panel_icon_flight_mode_on" id="0x7f0200fb" />
<public type="drawable" name="akt_quick_panel_icon_sync_mode_off" id="0x7f0200fc" />
<public type="drawable" name="akt_quick_panel_icon_sync_mode_on" id="0x7f0200fd" />
<public type="drawable" name="akt_lonyii_icon_brightness_off" id="0x7f0200fe" />
<public type="drawable" name="akt_lonyii_icon_brightness_on" id="0x7f0200ff" />
<public type="drawable" name="lonyii_icon_shutdown" id="0x7f020100" />
<public type="layout" name="lonyii_gps_alertdialog" id="0x7f030007" />
<public type="layout" name="lonyii_mobiledata_alertdialog" id="0x7f030008" />
<public type="layout" name="lonyii_mobiledata_offdialog" id="0x7f030009" />
<public type="layout" name="lonyii_quick_settings" id="0x7f03000a" />
<public type="string" name="lonyii_wifi_text" id="0x7f070011" />
<public type="string" name="lonyii_bluetooth_text" id="0x7f070012" />
<public type="string" name="lonyii_gps_text" id="0x7f070013" />
<public type="string" name="lonyii_mobiledata_text" id="0x7f070014" />
<public type="string" name="lonyii_sound_vibration_text" id="0x7f070015" />
<public type="string" name="lonyii_silent_text" id="0x7f070016" />
<public type="string" name="lonyii_vibration_text" id="0x7f070017" />
<public type="string" name="lonyii_rotation_text" id="0x7f070018" />
<public type="string" name="lonyii_error_text" id="0x7f070019" />
<public type="string" name="lonyii_sound_text" id="0x7f07001a" />
<public type="string" name="location_3rdparty_gps_dialogtext" id="0x7f07001b" />
<public type="string" name="mobiledata_dialogtext" id="0x7f07001c" />
<public type="string" name="warning_alert_check" id="0x7f07001d" />
<public type="string" name="mobiledataconnection_dialogtext" id="0x7f07001e" />
<public type="string" name="location_title" id="0x7f07001f" />
<public type="string" name="mobiledata_title" id="0x7f070020" />
<public type="string" name="mobiledata_connect" id="0x7f070021" />
<public type="string" name="mobiledataconnection_title" id="0x7f070022" />
<public type="string" name="agree" id="0x7f070023" />
<public type="string" name="lonyii_flight_text" id="0x7f070024" />
<public type="string" name="lonyii_sync_text" id="0x7f070025" />
<public type="string" name="lonyii_brightness_text" id="0x7f070026" />
<public type="string" name="shutdown_confirm" id="0x7f070027" />
<public type="string" name="lonyii_shutdown_text" id="0x7f070028" />
<public type="string" name="hamster" id="0x7f070029" />
<public type="id" name="lonyii_quick_settings" id="0x7f09001c" />
<public type="id" name="lonyii_wifi_btn_icon" id="0x7f09001d" />
<public type="id" name="lonyii_wifi_btn_text" id="0x7f09001e" />
<public type="id" name="lonyii_wifi_btn_status_icon" id="0x7f09001f" />
<public type="id" name="lonyii_bt_btn_icon" id="0x7f090020" />
<public type="id" name="lonyii_bt_btn_text" id="0x7f090021" />
<public type="id" name="lonyii_bt_btn_status_icon" id="0x7f090022" />
<public type="id" name="lonyii_gps_btn_icon" id="0x7f090023" />
<public type="id" name="lonyii_gps_btn_text" id="0x7f090024" />
<public type="id" name="lonyii_gps_btn_status_icon" id="0x7f090025" />
<public type="id" name="lonyii_mobiledata_btn_icon" id="0x7f090026" />
<public type="id" name="lonyii_mobiledata_btn_text" id="0x7f090027" />
<public type="id" name="lonyii_mobiledata_btn_status_icon" id="0x7f090028" />
<public type="id" name="lonyii_rotation_btn_icon" id="0x7f090029" />
<public type="id" name="lonyii_rotation_btn_text" id="0x7f09002a" />
<public type="id" name="lonyii_rotation_btn_status_icon" id="0x7f09002b" />
<public type="id" name="lonyii_sound_btn_icon" id="0x7f09002c" />
<public type="id" name="lonyii_sound_btn_text" id="0x7f09002d" />
<public type="id" name="lonyii_sound_btn_status_icon" id="0x7f09002e" />
<public type="id" name="gps_Text" id="0x7f09002f" />
<public type="id" name="mobiledata_text" id="0x7f090030" />
<public type="id" name="mobiledata_checkbox" id="0x7f090031" />
<public type="id" name="lonyii_flight_btn_icon" id="0x7f090032" />
<public type="id" name="lonyii_flight_btn_text" id="0x7f090033" />
<public type="id" name="lonyii_flight_btn_status_icon" id="0x7f090034" />
<public type="id" name="lonyii_sync_btn_icon" id="0x7f090035" />
<public type="id" name="lonyii_sync_btn_text" id="0x7f090036" />
<public type="id" name="lonyii_sync_btn_status_icon" id="0x7f090037" />
<public type="id" name="lonyii_brightness_btn_icon" id="0x7f090038" />
<public type="id" name="lonyii_brightness_btn_text" id="0x7f090039" />
<public type="id" name="lonyii_brightness_btn_status_icon" id="0x7f09003a" />
<public type="id" name="lonyii_wifi_btn" id="0x7f09003b" />
<public type="id" name="lonyii_bt_btn" id="0x7f09003c" />
<public type="id" name="lonyii_gps_btn" id="0x7f09003d" />
<public type="id" name="lonyii_sound_btn" id="0x7f09003e" />
<public type="id" name="lonyii_rotation_btn" id="0x7f09003f" />
<public type="id" name="lonyii_mobiledata_btn" id="0x7f090040" />
<public type="id" name="lonyii_flight_btn" id="0x7f090041" />
<public type="id" name="lonyii_sync_btn" id="0x7f090042" />
<public type="id" name="lonyii_brightness_btn" id="0x7f090043" />
<public type="id" name="lonyii" id="0x7f090044" />
<public type="id" name="lonyii_shutdown_btn_icon" id="0x7f090045" />
<public type="id" name="lonyii_shutdown_btn_text" id="0x7f090046" />
<public type="id" name="lonyii_shutdown_btn_status_icon" id="0x7f090047" />
<public type="id" name="lonyii_shutdown_btn" id="0x7f090048" />
看type,其中drawable就是我们上面提取的图片,string就是在strings.xml里面的字符串,记下有哪些,待会去strings.xml里面复制,id和string类似,是在ids.xml里面的,也记下来先,layout即是xml布局文件,都在SystemUI\res\layout这个文件夹里面,
字符类提取:
1.strings.xml
复制public.xml里面看到的string字符串:
<string name="lonyii_wifi_text" />
<string name="lonyii_bluetooth_text" />
<string name="lonyii_gps_text" />
<string name="lonyii_mobiledata_text" />
<string name="lonyii_sound_vibration_text" />
<string name="lonyii_silent_text" />
<string name="lonyii_vibration_text" />
<string name="lonyii_rotation_text" />
<string name="lonyii_error_text" />
<string name="lonyii_sound_text" />
<string name="location_3rdparty_gps_dialogtext">By selecting \"Standalone GPS services\", you are allowing access to all location information by any third party through web access or any software or peripheral components you chose to install, download, add/or attach to the device or any other means. Enabling this functionality could pose certain risks to users of this device.</string>
<string name="mobiledata_dialogtext">You will no longer be able to use data applications such as Browser, Email and YouTube via mobile network. Calls and text messages will continue to function. Continue?</string>
<string name="warning_alert_check">Do not display this message again.</string>
<string name="mobiledataconnection_dialogtext">Mobile data connection is currently disabled. You need to connect Mobile data to use data applications such as Browser, Email and YouTube via mobile network. Do you want to make the connection?</string>
<string name="location_title">My location</string>
<string name="mobiledata_title">Mobile data</string>
<string name="mobiledata_connect">Connect</string>
<string name="mobiledataconnection_title">Mobile data connection</string>
<string name="agree">Agree</string>
<string name="lonyii_flight_text" />
<string name="lonyii_sync_text" />
<string name="lonyii_brightness_text" />
<string name="shutdown_confirm">Your phone will take a rest from You.</string>
<string name="lonyii_shutdown_text">Shutdown</string>
<string name="hamster">ArgenStone</string>
复制代码
2.ids.xml
复制public.xml里面看到的id字符串:
<item type="id" name="lonyii_quick_settings">false</item>
<item type="id" name="lonyii_wifi_btn_icon">false</item>
<item type="id" name="lonyii_wifi_btn_text">false</item>
<item type="id" name="lonyii_wifi_btn_status_icon">false</item>
<item type="id" name="lonyii_bt_btn_icon">false</item>
<item type="id" name="lonyii_bt_btn_text">false</item>
<item type="id" name="lonyii_bt_btn_status_icon">false</item>
<item type="id" name="lonyii_gps_btn_icon">false</item>
<item type="id" name="lonyii_gps_btn_text">false</item>
<item type="id" name="lonyii_gps_btn_status_icon">false</item>
<item type="id" name="lonyii_mobiledata_btn_icon">false</item>
<item type="id" name="lonyii_mobiledata_btn_text">false</item>
<item type="id" name="lonyii_mobiledata_btn_status_icon">false</item>
<item type="id" name="lonyii_rotation_btn_icon">false</item>
<item type="id" name="lonyii_rotation_btn_text">false</item>
<item type="id" name="lonyii_rotation_btn_status_icon">false</item>
<item type="id" name="lonyii_sound_btn_icon">false</item>
<item type="id" name="lonyii_sound_btn_text">false</item>
<item type="id" name="lonyii_sound_btn_status_icon">false</item>
<item type="id" name="gps_Text">false</item>
<item type="id" name="mobiledata_text">false</item>
<item type="id" name="mobiledata_checkbox">false</item>
<item type="id" name="lonyii_flight_btn_icon">false</item>
<item type="id" name="lonyii_flight_btn_text">false</item>
<item type="id" name="lonyii_flight_btn_status_icon">false</item>
<item type="id" name="lonyii_sync_btn_icon">false</item>
<item type="id" name="lonyii_sync_btn_text">false</item>
<item type="id" name="lonyii_sync_btn_status_icon">false</item>
<item type="id" name="lonyii_brightness_btn_icon">false</item>
<item type="id" name="lonyii_brightness_btn_text">false</item>
<item type="id" name="lonyii_brightness_btn_status_icon">false</item>
<item type="id" name="lonyii_wifi_btn">false</item>
<item type="id" name="lonyii_bt_btn">false</item>
<item type="id" name="lonyii_gps_btn">false</item>
<item type="id" name="lonyii_sound_btn">false</item>
<item type="id" name="lonyii_rotation_btn">false</item>
<item type="id" name="lonyii_mobiledata_btn">false</item>
<item type="id" name="lonyii_flight_btn">false</item>
<item type="id" name="lonyii_sync_btn">false</item>
<item type="id" name="lonyii_brightness_btn">false</item>
<item type="id" name="lonyii">false</item>
<item type="id" name="lonyii_shutdown_btn_icon">false</item>
<item type="id" name="lonyii_shutdown_btn_text">false</item>
<item type="id" name="lonyii_shutdown_btn_status_icon">false</item>
<item type="id" name="lonyii_shutdown_btn">false</item>
文件部分提取,就是layout了,从public.xml可得知有以下几个布局文件
lonyii_gps_alertdialog.xml
lonyii_mobiledata_alertdialog.xml
lonyii_mobiledata_offdialog.xml
lonyii_quick_settings.xml
另外因为在status_bar_expanded.xml里面有一句关键代码 即<include layout="@layout/lonyii_quick_settings" />,这句话要插入到你要放快捷面板的地方,不然你就算把其它全弄好了还是会不显示的
-------------------------------------------------
至此,该提取的都提取完了,下面是最繁琐的部分了
----第一步,将提取的东西放入相应的地方
这里有个算是小技巧吧,public.xml里面的东西不用提取,原因后面会提到
注:以下出现的SystemUI.apk均是指待添加快捷面板的SystemUI.apk
.把图片放到你要添加快捷面板的系统的SystemUI.apk(当然要反编译)的对应目录,即SystemUI\res\drawable-hdpi
.把lonyii文件夹整个复制到SystemUI\smali\com\android\systemui\statusbar,新手不要改文件夹名字,不然会没用的。
.layout里面的文件复制到SystemUI\res\layout
.在SystemUI\res\layout\status_bar_expanded.xml在适当的位置添加一句<include layout="@layout/lonyii_quick_settings" />,参考小猪的布局 status_bar_expanded.rar (1.08 KB, 下载次数: 182)
.SystemUI\res\values\strings.xml文件里照原有的格式添加前面提取的strings
.SystemUI\res\values\ids.xml ,同上
OK了,重编译吧,不出意外的话应该能顺利编译成功的
到这了,还不能用,
为了避免签名问题,统一一下步骤吧
把编译好的文件压进原来的SystemUI.apk(貌似AndroidMainfest.xml不能弄进去,不是很清楚,最好不用吧)
----第二步:再次反编译SystemUI.apk
打开SystemUI\res\values\public.xml,是不是发现了很多:书签1的代码?
现在应该知道为什么之前不用提取public.xml里的东西了吧
注意这里的id=后面的数值,这些数值有81个地方要更新到smali快捷面板主程序中
这一步是最后一步,也是最繁琐的一步,考验耐心 - -至少我在写DEFY通用补丁这个功能的时候就是自己手动一个个查找public.xml里面的原始数值在快捷面板smali里面对应的地方,然后用新编译生成的public.xml找到对应的新数值替换进去,不然你不替换的话,一开机拉下通知栏就会发现快捷面板位置会惨不忍睹的 - -
重新编译后替换进手机,这些都是基本功就不多说了
the END.
广告一下:
DEFY通用补丁
可以帮你全自动添加快捷面板,原理及实现方法就是以上所述,唯一影响通用的就是status_bar_expanded.xml这个布局文件了,2.3的系统一般都带有SystemUI.apk,2.2不带的,所以2.2不可用,未deodex的系统也不可用
通知栏快捷按钮自定义教程以及快捷面板提取的思路-转自魔趣论坛-lonyii2