Improve Wi-Fi Settings UI in guest mode
Progress bar is still seen along with a permission forbidden tip in
guest mode and it's confusing. It should be hidden because actually
nothing happens there.
When Wi-Fi is off, Wi-Fi OFF tip should be shown even in guest mode
becuase it should be consistent with Wi-Fi status.
Improves d8c3ca43163427a75c8b70114096238177f97af0.
Bug:31235488
Test: manual inspection.
Change-Id: I611719db253a0aec03d61e881af0e5dc3869d50b
Merged-In: If89728e293721cea45dcd717316d87f6df17ea7c
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 9d0d556..dcf722b 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);
}
}
@@ -602,14 +603,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:
@@ -702,7 +708,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;
@@ -758,7 +764,7 @@
protected void setProgressBarVisible(boolean visible) {
if (mProgressHeader != null) {
- mProgressHeader.setVisibility(visible ? View.VISIBLE : View.GONE);
+ mProgressHeader.setVisibility(visible && !isUiRestricted() ? View.VISIBLE : View.GONE);
}
}