Merge "Expand Wifi Picker Menu by default."

This commit is contained in:
TreeHugger Robot
2017-03-27 20:04:21 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 29 deletions

View File

@@ -1612,8 +1612,6 @@
<string name="wifi_starting">Turning Wi\u2011Fi on\u2026</string> <string name="wifi_starting">Turning Wi\u2011Fi on\u2026</string>
<!-- Summary text when turning Wi-Fi or bluetooth off --> <!-- Summary text when turning Wi-Fi or bluetooth off -->
<string name="wifi_stopping">Turning off Wi\u2011Fi\u2026</string> <string name="wifi_stopping">Turning off Wi\u2011Fi\u2026</string>
<!-- Title of Button to show all Wi-Fi networks in the picker. [CHAR LIMIT=30] -->
<string name="wifi_see_all_networks_button_title">See all networks</string>
<!-- Summary text when Wi-Fi or bluetooth has error --> <!-- Summary text when Wi-Fi or bluetooth has error -->
<string name="wifi_error">Error</string> <string name="wifi_error">Error</string>
<!-- Summary text when wifi SoftAP started failed due to no legal usable channel allowed in this region by regulatory --> <!-- Summary text when wifi SoftAP started failed due to no legal usable channel allowed in this region by regulatory -->

View File

@@ -139,10 +139,6 @@ public class WifiSettings extends RestrictedSettingsFragment
// should Next button only be enabled when we have a connection? // should Next button only be enabled when we have a connection?
private boolean mEnableNextOnConnection; private boolean mEnableNextOnConnection;
// should see all networks instead of collapsing networks and showing mSeeAllNetworksPreference.
private boolean mSeeAllNetworks;
private static final int NETWORKS_TO_INITIALLY_SHOW = 5;
// Save the dialog details // Save the dialog details
private int mDialogMode; private int mDialogMode;
private AccessPoint mDlgAccessPoint; private AccessPoint mDlgAccessPoint;
@@ -160,7 +156,6 @@ public class WifiSettings extends RestrictedSettingsFragment
private PreferenceCategory mAccessPointsPreferenceCategory; private PreferenceCategory mAccessPointsPreferenceCategory;
private PreferenceCategory mAdditionalSettingsPreferenceCategory; private PreferenceCategory mAdditionalSettingsPreferenceCategory;
private Preference mAddPreference; private Preference mAddPreference;
private Preference mSeeAllNetworksPreference;
private Preference mConfigureWifiSettingsPreference; private Preference mConfigureWifiSettingsPreference;
private Preference mSavedNetworksPreference; private Preference mSavedNetworksPreference;
private LinkablePreference mStatusMessagePreference; private LinkablePreference mStatusMessagePreference;
@@ -210,10 +205,6 @@ public class WifiSettings extends RestrictedSettingsFragment
mAddPreference = new Preference(prefContext); mAddPreference = new Preference(prefContext);
mAddPreference.setIcon(R.drawable.ic_menu_add_inset); mAddPreference.setIcon(R.drawable.ic_menu_add_inset);
mAddPreference.setTitle(R.string.wifi_add_network); mAddPreference.setTitle(R.string.wifi_add_network);
mSeeAllNetworksPreference = new Preference(prefContext);
mSeeAllNetworksPreference.setIcon(R.drawable.ic_arrow_down_24dp);
mSeeAllNetworksPreference.setTitle(R.string.wifi_see_all_networks_button_title);
mSeeAllNetworks = false;
mStatusMessagePreference = new LinkablePreference(prefContext); mStatusMessagePreference = new LinkablePreference(prefContext);
mUserBadgeCache = new AccessPointPreference.UserBadgeCache(getPackageManager()); mUserBadgeCache = new AccessPointPreference.UserBadgeCache(getPackageManager());
@@ -525,9 +516,6 @@ public class WifiSettings extends RestrictedSettingsFragment
} }
} else if (preference == mAddPreference) { } else if (preference == mAddPreference) {
onAddNetworkPressed(); onAddNetworkPressed();
} else if (preference == mSeeAllNetworksPreference) {
mSeeAllNetworks = true;
onAccessPointsChanged();
} else { } else {
return super.onPreferenceTreeClick(preference); return super.onPreferenceTreeClick(preference);
} }
@@ -671,12 +659,8 @@ public class WifiSettings extends RestrictedSettingsFragment
int index = int index =
configureConnectedAccessPointPreferenceCategory(accessPoints) ? 1 : 0; configureConnectedAccessPointPreferenceCategory(accessPoints) ? 1 : 0;
boolean fewerNetworksThanLimit = int numAccessPoints = accessPoints.size();
accessPoints.size() <= index + NETWORKS_TO_INITIALLY_SHOW; for (; index < numAccessPoints; index++) {
int numAccessPointsToShow = mSeeAllNetworks || fewerNetworksThanLimit
? accessPoints.size() : index + NETWORKS_TO_INITIALLY_SHOW;
for (; index < numAccessPointsToShow; index++) {
AccessPoint accessPoint = accessPoints.get(index); AccessPoint accessPoint = accessPoints.get(index);
// Ignore access points that are out of range. // Ignore access points that are out of range.
if (accessPoint.isReachable()) { if (accessPoint.isReachable()) {
@@ -707,15 +691,8 @@ public class WifiSettings extends RestrictedSettingsFragment
} }
} }
removeCachedPrefs(mAccessPointsPreferenceCategory); removeCachedPrefs(mAccessPointsPreferenceCategory);
if (mSeeAllNetworks || fewerNetworksThanLimit) { mAddPreference.setOrder(index);
mAccessPointsPreferenceCategory.removePreference(mSeeAllNetworksPreference); mAccessPointsPreferenceCategory.addPreference(mAddPreference);
mAddPreference.setOrder(index);
mAccessPointsPreferenceCategory.addPreference(mAddPreference);
} else {
mAccessPointsPreferenceCategory.removePreference(mAddPreference);
mSeeAllNetworksPreference.setOrder(index);
mAccessPointsPreferenceCategory.addPreference(mSeeAllNetworksPreference);
}
setConfigureWifiSettingsVisibility(); setConfigureWifiSettingsVisibility();
if (!hasAvailableAccessPoints) { if (!hasAvailableAccessPoints) {