[Sony Cross-Device Development Themes and Apps] venkat kamesh:
Hello guys

Many users asked me for on.... How to add switches for wifi /bluetooth/ network

and how do i made that

So here is a small tut on how to add this option to your settings (Thanks to CyanogenMod sources )

You need Deodexed Settings.apk

1. Decompile the settings.apk

2. Open settings.apk/res/values/attrs.xml

Add this Code

<attr name="switchClass" format="string" />
<attr name="advanced" format="boolean" />

3. Open settings.apk/res/layout_land/dashboard_tile.xml

select all the code lines and replace with this

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="@dimen/dashboard_tile_minimum_height"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_weight="1.0">
<ImageView android:id="@id/icon" android:layout_width="@dimen/dashboard_tile_image_size" android:layout_height="@dimen/dashboard_tile_image_size" android:scaleType="centerInside" android:layout_marginStart="@dimen/dashboard_tile_image_margin_start" android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
<RelativeLayout android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
<TextView android:textAppearance="@style/TextAppearance.TileTitle" android:ellipsize="marquee" android:id="@id/title" android:fadingEdge="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" />
<TextView android:textAppearance="@style/TextAppearance.Small" android:textColor="?android:textColorSecondary" android:id="@id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/title" android:layout_alignStart="@android:id/title" />
</RelativeLayout>
<Switch android:id="@+id/dashboard_switch" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingEnd="@dimen/action_bar_switch_padding" />
</LinearLayout>
<View android:id="@id/tile_divider" android:background="?android:dividerVertical" android:layout_width="fill_parent" android:layout_height="1.0dip" />
</LinearLayout>
</LinearLayout>

4. Open settings.apk/res/layout/dashboard_tile.xml

select all the code and replace with this code

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center_vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="@dimen/dashboard_tile_minimum_height"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="@+id/icon" android:layout_width="@dimen/dashboard_tile_image_size" android:layout_height="@dimen/dashboard_tile_image_size" android:scaleType="centerInside" android:layout_marginStart="@dimen/dashboard_tile_image_margin_start" android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:gravity="center_vertical" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_weight="1.0">
<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
<Switch android:id="@+id/dashboard_switch" android:paddingRight="@dimen/action_bar_switch_padding" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" />
<TextView android:textAppearance="@style/TextAppearance.TileTitle" android:ellipsize="marquee" android:id="@+id/title" android:fadingEdge="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_toStartOf="@+id/dashboard_switch" android:layout_alignParentStart="true" android:layout_alignParentEnd="false" />
<TextView android:textAppearance="@style/TextAppearance.Small" android:textColor="?android:textColorSecondary" android:id="@+id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/title" android:layout_toStartOf="@+id/dashboard_switch" android:layout_alignStart="@android:id/title" android:layout_alignParentStart="true" />
</RelativeLayout>
</LinearLayout>
<View android:id="@+id/tile_divider" android:background="?android:dividerVertical" android:layout_width="fill_parent" android:layout_height="1.0dip" />
</LinearLayout>
</LinearLayout>

5. Open settings.apk/res/xml/dashboard_categories.xml

find this code

xmlns:android="http://schemas.android.com/apk/res/android" >

Replace with this

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">

and replace first two code lines

<dashboard-tile android:icon="@drawable/ic_settings_wireless" android:id="@id/wifi_settings" android:title="@string/wifi_settings_title" android:fragment="com.android.settings.wifi.WifiSettings" settings:switchClass="com.android.settings.wifi.WifiEnabler" />
<dashboard-tile android:icon="@drawable/ic_settings_bluetooth2" android:id="@id/bluetooth_settings" android:title="@string/bluetooth_settings_title" android:fragment="com.android.settings.bluetooth.BluetoothSettings" settings:switchClass="com.android.settings.bluetooth.BluetoothEnabler" />
<dashboard-tile android:icon="@drawable/ic_settings_cellular" android:id="@+id/mobile_networks" android:title="@string/network_settings_title" settings:switchClass="com.android.settings.dashboard.MobileNetworksEnabler">
<intent android:targetPackage="com.android.phone" android:action="android.intent.action.MAIN" android:targetClass="com.android.phone.MobileNetworkSettings" />
</dashboard-tile>

6. Download this View attachment 3569447

and merge them

7. Continued in #2 post ( main part with a circus work lol :p )