Add modify button to WifiNetworkDetailsFragment.
Adds pencil icon to Wifi Detail action bar to modify the network. Modifies package/public visibility to allow the detail package to use the WifiDialog. Listens for changes in WifiConfigurations to propagate changes to the UI in WifiNetworkDetailsFragment. Changes WifiNetworkDetail preference launch to conform to pattern of other Settings apps. Removes unused WifiDetailActionBarObserver. Bug: 36483704, 37082355 Test: make -j40 RunSettingsRoboTests Change-Id: Ie9dc1892eaefdfad4a6bd7040bfc5dbf6236cfb4
This commit is contained in:
@@ -884,17 +884,20 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
* {@link #mConnectedAccessPointPreferenceCategory}.
|
||||
*/
|
||||
private void addConnectedAccessPointPreference(AccessPoint connectedAp) {
|
||||
String key = connectedAp.getBssid();
|
||||
LongPressAccessPointPreference pref = (LongPressAccessPointPreference)
|
||||
getCachedPreference(key);
|
||||
if (pref == null) {
|
||||
pref = createLongPressActionPointPreference(connectedAp);
|
||||
}
|
||||
final LongPressAccessPointPreference pref = getOrCreatePreference(connectedAp);
|
||||
|
||||
// Save the state of the current access point in the bundle so that we can restore it
|
||||
// in the Wifi Network Details Fragment
|
||||
pref.getAccessPoint().saveWifiState(pref.getExtras());
|
||||
pref.setFragment(WifiNetworkDetailsFragment.class.getName());
|
||||
|
||||
// Launch details page on click.
|
||||
pref.setOnPreferenceClickListener(preference -> {
|
||||
SettingsActivity activity = (SettingsActivity) WifiSettings.this.getActivity();
|
||||
activity.startPreferencePanel(this,
|
||||
WifiNetworkDetailsFragment.class.getName(), pref.getExtras(),
|
||||
R.string.wifi_details_title, null, null, 0);
|
||||
return true;
|
||||
});
|
||||
pref.refresh();
|
||||
|
||||
mConnectedAccessPointPreferenceCategory.addPreference(pref);
|
||||
@@ -905,6 +908,15 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
}
|
||||
}
|
||||
|
||||
private LongPressAccessPointPreference getOrCreatePreference(AccessPoint ap) {
|
||||
LongPressAccessPointPreference pref = (LongPressAccessPointPreference)
|
||||
getCachedPreference(AccessPointPreference.generatePreferenceKey(ap));
|
||||
if (pref == null) {
|
||||
pref = createLongPressActionPointPreference(ap);
|
||||
}
|
||||
return pref;
|
||||
}
|
||||
|
||||
/** Removes all preferences and hide the {@link #mConnectedAccessPointPreferenceCategory}. */
|
||||
private void removeConnectedAccessPointPreference() {
|
||||
mConnectedAccessPointPreferenceCategory.removeAll();
|
||||
|
Reference in New Issue
Block a user