Scroll to top when user connects to a network.
We now track when the user initiates a connection request, and upon
connection will scroll to the connected network.
Bug: 34093572
Test: Open wifi picker. Connect to a new or different network. The picker
should scroll to the top of list
Change-Id: I7bed31b0dd4f40333f76f8389612f7fd55f2620e
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index f0457e6..89e5b74 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -176,6 +176,12 @@
// For Search
private static final String DATA_KEY_REFERENCE = "main_toggle_wifi";
+ /**
+ * Tracks whether the user initiated a connection via clicking in order to autoscroll to the
+ * network once connected.
+ */
+ private boolean mClickedConnect;
+
/* End of "used in Wifi Setup context" */
public WifiSettings() {
@@ -894,6 +900,10 @@
mConnectedAccessPointPreferenceCategory.addPreference(pref);
mConnectedAccessPointPreferenceCategory.setVisible(true);
+ if (mClickedConnect) {
+ mClickedConnect = false;
+ scrollToPreference(mConnectedAccessPointPreferenceCategory);
+ }
}
/** Removes all preferences and hide the {@link #mConnectedAccessPointPreferenceCategory}. */
@@ -1039,7 +1049,7 @@
mMetricsFeatureProvider.action(getActivity(), MetricsEvent.ACTION_WIFI_CONNECT,
isSavedNetwork);
mWifiManager.connect(config, mConnectListener);
- scrollToPreference(mConnectedAccessPointPreferenceCategory);
+ mClickedConnect = true;
}
protected void connect(final int networkId, boolean isSavedNetwork) {