Merge "Improve Wi-Fi Settings UI in guest mode"
am: 31f64a1253

Change-Id: I15f05538344aa615a4f69eebf7fdec66efc3cf29
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 4456172..4ca8b8d 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -168,6 +168,7 @@
         final Activity activity = getActivity();
         if (activity != null) {
             mProgressHeader = (ProgressBar) setPinnedHeaderView(R.layout.wifi_progress_header);
+            setProgressBarVisible(false);
         }
     }
 
@@ -603,14 +604,19 @@
     public void onAccessPointsChanged() {
         // Safeguard from some delayed event handling
         if (getActivity() == null) return;
+        final int wifiState = mWifiManager.getWifiState();
         if (isUiRestricted()) {
             if (!isUiRestrictedByOnlyAdmin()) {
-                addMessagePreference(R.string.wifi_empty_list_user_restricted);
+                if (WifiManager.WIFI_STATE_DISABLED == wifiState) {
+                    addMessagePreference(R.string.wifi_empty_list_wifi_off);
+                }
+                else {
+                    addMessagePreference(R.string.wifi_empty_list_user_restricted);
+                }
             }
             getPreferenceScreen().removeAll();
             return;
         }
-        final int wifiState = mWifiManager.getWifiState();
 
         switch (wifiState) {
             case WifiManager.WIFI_STATE_ENABLED:
@@ -703,7 +709,7 @@
     private void setOffMessage() {
         if (isUiRestricted()) {
             if (!isUiRestrictedByOnlyAdmin()) {
-                addMessagePreference(R.string.wifi_empty_list_user_restricted);
+                addMessagePreference(R.string.wifi_empty_list_wifi_off);
             }
             getPreferenceScreen().removeAll();
             return;
@@ -759,7 +765,7 @@
 
     protected void setProgressBarVisible(boolean visible) {
         if (mProgressHeader != null) {
-            mProgressHeader.setVisibility(visible ? View.VISIBLE : View.GONE);
+            mProgressHeader.setVisibility(visible && !isUiRestricted() ? View.VISIBLE : View.GONE);
         }
     }