OSDN Git Service

Re-enable on/off switch for Wi-Fi and Bluetooth Settings
authorFabrice Di Meglio <fdimeglio@google.com>
Thu, 3 Apr 2014 20:57:56 +0000 (13:57 -0700)
committerThe Android Automerger <android-build@android.com>
Fri, 4 Apr 2014 21:50:00 +0000 (14:50 -0700)
- the switch was no more there when launching from an Intent (it was a regression)

Change-Id: I1fc95cad4523a1d3812323fb26908f925a9e623e

src/com/android/settings/bluetooth/BluetoothSettings.java
src/com/android/settings/wifi/WifiSettings.java

index 624b318..7068bc7 100755 (executable)
@@ -129,14 +129,12 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
 
         final SettingsActivity activity = (SettingsActivity) getActivity();
 
-        if (activity.onIsHidingHeaders()) {
-            activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
-                    ActionBar.DISPLAY_SHOW_CUSTOM);
-            activity.getActionBar().setCustomView(mSwitch, new ActionBar.LayoutParams(
-                    ActionBar.LayoutParams.WRAP_CONTENT,
-                    ActionBar.LayoutParams.WRAP_CONTENT,
-                    Gravity.CENTER_VERTICAL | Gravity.END));
-        }
+        activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
+                ActionBar.DISPLAY_SHOW_CUSTOM);
+        activity.getActionBar().setCustomView(mSwitch, new ActionBar.LayoutParams(
+                ActionBar.LayoutParams.WRAP_CONTENT,
+                ActionBar.LayoutParams.WRAP_CONTENT,
+                Gravity.CENTER_VERTICAL | Gravity.END));
     }
 
     @Override
index 21fecd3..43f9f75 100644 (file)
@@ -412,12 +412,9 @@ public class WifiSettings extends RestrictedSettingsFragment
             final Activity activity = getActivity();
 
             mSwitch = new Switch(activity);
-            boolean addSwitch = false;
+            boolean addSwitch = true;
 
-            if (activity instanceof SettingsActivity) {
-                SettingsActivity sa = (SettingsActivity) activity;
-                addSwitch = sa.onIsHidingHeaders();
-            } else if (activity instanceof WifiPickerActivity) {
+            if (activity instanceof WifiPickerActivity) {
                 PreferenceActivity pa = (PreferenceActivity) activity;
                 addSwitch = pa.onIsHidingHeaders();
             }