Hey dudes!
Ace-I Team is back with a new guide. One of the most advanced ICS Features now comes on Gingerbread! Admit it, Everyone has been attracted by this feature! That's why : THIS IS THE MOST WANTED GUIDE FOR GINGERBREAD DEVICES EVER!!
Wifi and bluetooth ON/OFF Switches on Settings!
Let's go!
Ace-I Team is back with a new guide. One of the most advanced ICS Features now comes on Gingerbread! Admit it, Everyone has been attracted by this feature! That's why : THIS IS THE MOST WANTED GUIDE FOR GINGERBREAD DEVICES EVER!!
Wifi and bluetooth ON/OFF Switches on Settings!
Requirements :
-APK Multi Tool
-Notepad++
-Sources on the attachments
-High Smali & xml knowledge
-Brain
-Patience
Let's go!
PART I
1. Decompile Settings.apk
2. Extract the sources. Copy switch_holo_dark.xml from sources and paste it on drawable folder.
3. Copy the PNGs from the sources and paste them on drawable-mdpi folder.
4. Copy icon_checkbox_preference.xml from the sources and paste it on layout folder.
5. Go to res/values/styles.xml.
Paste this text on the end of the file before
Code:<style name="Switch"> <item name="android:checkboxStyle">@style/Widget.CompoundButton.CheckBox.Holo.Dark</item> </style> <style name="Widget.CompoundButton.CheckBox.Holo.Dark" parent="@android:style/Widget.CompoundButton.CheckBox"> <item name="android:button">@drawable/switch_holo_dark</item> </style>
6. Go to res/values/public.xml
Paste this text on the end of he file before
Code:<public type="layout" name="icon_checkbox_preference" id="0x7f03005a" /> </resources>
7. Go to xml/Settings.xml
Replace this :
With this :
Code:<com.android.settings.IconCheckBoxPreference android:title="WIFI" android:key="toggle_wifi" settings:icon="@drawable/ic_settings_wireless" /> <com.android.settings.IconCheckBoxPreference android:title="Bluetooth" android:key="toggle_bluetooth" settings:icon="@drawable/ic_settings_bluetooth2" />
After editing it will look like this :
8. Recompile Settings.
PART II
1. Decompile Settings.apk again
2. Go to smali/com/android/settings
3. Copy icon_checkbox_preference.smali from the source on the that folder.
4. Open R$Styleable
- Find :
Code:# static fields .field public static final BatteryHistoryChart:[I
Below that paste :
Code:.field public static final IconPreference:[I .field public static final IconPreference_icon:I
- Find :
Code:const v1, 0x7f010001 aput v1, v0, v2
Below that paste :
Code:sput-object v0, Lcom/android/settings/R$styleable;->IconPreference:[I .line 6450 new-array v0, v3, [I const v1, 0x7f010001 aput v1, v0, v2
After the edit it will look like this :
Code:const v1, 0x7f010001 aput v1, v0, v2 sput-object v0, Lcom/android/settings/R$styleable;->IconPreference:[I .line 6450 new-array v0, v3, [I const v1, 0x7f010001 aput v1, v0, v2 sput-object v0, Lcom/android/settings/R$styleable;->IconPreferenceScreen:[I
5. Open Settings.smali
Below # instance fields paste this text :
Code:.field private mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler; .field private mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler;
2 Lines Above # instance fields paste this text :
Code:# static fields .field private static final KEY_TOGGLE_BLUETOOTH:Ljava/lang/String; = "toggle_bluetooth" .field private static final KEY_TOGGLE_WIFI:Ljava/lang/String; = "toggle_wifi"
After edition it will look like this :
;Code:# static fields .field private static final KEY_TOGGLE_BLUETOOTH:Ljava/lang/String; = "toggle_bluetooth" .field private static final KEY_TOGGLE_WIFI:Ljava/lang/String; = "toggle_wifi" # instance fields .field private mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler; .field private mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler; .field private mIntentReceiver:Landroid/content/BroadcastReceiver
- Find :
Code:invoke-virtual {p0, v4}, Lcom/android/settings/Settings;->addPreferencesFromResource(I)V
- Below that paste this text :
Code:const-string v0, "toggle_wifi" invoke-virtual {p0, v0}, Lcom/android/settings/Settings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference; move-result-object v0 check-cast v0, Landroid/preference/CheckBoxPreference; new-instance v1, Lcom/android/settings/wifi/WifiEnabler; invoke-direct {v1, p0, v0}, Lcom/android/settings/wifi/WifiEnabler;->(Landroid/content/Context;Landroid/preference/CheckBoxPreference;)V iput-object v1, p0, Lcom/android/settings/Settings;->mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler; const-string v0, "toggle_bluetooth" invoke-virtual {p0, v0}, Lcom/android/settings/Settings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference; move-result-object v0 check-cast v0, Landroid/preference/CheckBoxPreference; new-instance v1, Lcom/android/settings/bluetooth/BluetoothEnabler; invoke-direct {v1, p0, v0}, Lcom/android/settings/bluetooth/BluetoothEnabler;->(Landroid/content/Context;Landroid/preference/CheckBoxPreference;)V iput-object v1, p0, Lcom/android/settings/Settings;->mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler;
- Find :
Code:.method protected onPause()V
- Replace the whole method with this method :
Code:.method protected onPause()V .locals 1 invoke-super {p0}, Landroid/preference/PreferenceActivity;->onPause()V iget-object v0, p0, Lcom/android/settings/Settings;->mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler; invoke-virtual {v0}, Lcom/android/settings/wifi/WifiEnabler;->pause()V iget-object v0, p0, Lcom/android/settings/Settings;->mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler; invoke-virtual {v0}, Lcom/android/settings/bluetooth/BluetoothEnabler;->pause()V iget-object v0, p0, Lcom/android/settings/Settings;->mIntentReceiver:Landroid/content/BroadcastReceiver; invoke-virtual {p0, v0}, Lcom/android/settings/Settings;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V .line 78 return-void .end method
- Find :
Code:.line 65 invoke-super {p0}, Landroid/preference/PreferenceActivity;->onResume()V
- Below that paste this text :
Code:iget-object v1, p0, Lcom/android/settings/Settings;->mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler; invoke-virtual {v1}, Lcom/android/settings/wifi/WifiEnabler;->resume()V iget-object v1, p0, Lcom/android/settings/Settings;->mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler; invoke-virtual {v1}, Lcom/android/settings/bluetooth/BluetoothEnabler;->resume()V
8. Follow Part III by iamareebjamal
Attachments
Last edited: