Merge "Separate wifi AP added by applications."

This commit is contained in:
Vinit Deshpande
2014-09-27 02:01:13 +00:00
committed by Android (Google) Code Review
4 changed files with 47 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ public class WifiSettings extends RestrictedSettingsFragment
private static final int MENU_ID_FORGET = Menu.FIRST + 7;
private static final int MENU_ID_MODIFY = Menu.FIRST + 8;
private static final int MENU_ID_WRITE_NFC = Menu.FIRST + 9;
private static final int MENU_ID_APPS = Menu.FIRST + 10;
private static final String KEY_ASSISTANT_DISMISS_PLATFORM = "assistant_dismiss_platform";
@@ -142,6 +143,9 @@ public class WifiSettings extends RestrictedSettingsFragment
private TextView mEmptyView;
private boolean showAppIcons = false;
private MenuItem showAppMenuItem = null;
// this boolean extra specifies whether to disable the Next button when not connected. Used by
// account creation outside of setup wizard.
private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
@@ -420,6 +424,8 @@ public class WifiSettings extends RestrictedSettingsFragment
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.add(Menu.NONE, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
showAppMenuItem = menu.add(Menu.NONE, MENU_ID_APPS, 0, R.string.wifi_menu_apps);
showAppMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
ta.recycle();
}
@@ -496,6 +502,16 @@ public class WifiSettings extends RestrictedSettingsFragment
null);
}
return true;
case MENU_ID_APPS:
showAppIcons = !showAppIcons;
if (showAppIcons) {
showAppMenuItem.setTitle(R.string.wifi_menu_apps_strength);
} else {
showAppMenuItem.setTitle(R.string.wifi_menu_apps);
}
updateAccessPoints();
return true;
}
return super.onOptionsItemSelected(item);
}
@@ -663,6 +679,10 @@ public class WifiSettings extends RestrictedSettingsFragment
}
for (AccessPoint accessPoint : accessPoints) {
if (showAppIcons) {
accessPoint.showAppIcon();
}
// Ignore access points that are out of range.
if (accessPoint.getLevel() != -1) {
getPreferenceScreen().addPreference(accessPoint);