Merge "Scroll to top when user connects to a network." into oc-mr1-dev am: a253e1d416

am: 501975914c

Change-Id: Ic3489f58b427ee0be5b3ad39a801af02ec15835b
This commit is contained in:
Sundeep Ghuman
2017-08-25 00:57:11 +00:00
committed by android-build-merger

View File

@@ -176,6 +176,12 @@ public class WifiSettings extends RestrictedSettingsFragment
// 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() {
@@ -892,6 +898,10 @@ public class WifiSettings extends RestrictedSettingsFragment
mConnectedAccessPointPreferenceCategory.addPreference(pref);
mConnectedAccessPointPreferenceCategory.setVisible(true);
if (mClickedConnect) {
mClickedConnect = false;
scrollToPreference(mConnectedAccessPointPreferenceCategory);
}
}
/** Removes all preferences and hide the {@link #mConnectedAccessPointPreferenceCategory}. */
@@ -1037,7 +1047,7 @@ public class WifiSettings extends RestrictedSettingsFragment
mMetricsFeatureProvider.action(getActivity(), MetricsEvent.ACTION_WIFI_CONNECT,
isSavedNetwork);
mWifiManager.connect(config, mConnectListener);
scrollToPreference(mConnectedAccessPointPreferenceCategory);
mClickedConnect = true;
}
protected void connect(final int networkId, boolean isSavedNetwork) {