Update Network & internet->Wi-Fi to use MasterSwitchPreference.

- Add a preference controller for Network & internet->Wi-Fi to control
  the preference toggling and summary update.
- Refactor WifiSettings and WifiEnabler to share code between the new
  wifi preference controller and the wifi setting.
- Refactor BluetoothSummaryHelper to have a common base class with the
  WifiSummaryHelper.
- Rename the summary helper to summary updater.

Bug: 34280769
Test: make RunSettingsRoboTests
Change-Id: I00ebfc161bcef89331bb41ba405ed8cb8232d248
This commit is contained in:
Doris Ling
2017-01-23 16:16:06 -08:00
parent 42c61c10cc
commit c4c9f4d50e
24 changed files with 926 additions and 171 deletions

View File

@@ -45,7 +45,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.LinkifyUtils;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.bluetooth.BluetoothSummaryHelper.OnSummaryChangeListener;
import com.android.settings.widget.SummaryUpdater.OnSummaryChangeListener;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.location.ScanningSettings;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -150,14 +150,14 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
mBluetoothEnabler = new BluetoothEnabler(activity, new SwitchBarController(mSwitchBar),
mMetricsFeatureProvider, Utils.getLocalBtManager(activity));
mBluetoothEnabler.setupSwitchBar();
mBluetoothEnabler.setupSwitchController();
}
@Override
public void onDestroyView() {
super.onDestroyView();
mBluetoothEnabler.teardownSwitchBar();
mBluetoothEnabler.teardownSwitchController();
}
@Override
@@ -516,20 +516,19 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
private final SummaryLoader mSummaryLoader;
@VisibleForTesting
BluetoothSummaryHelper mSummaryHelper;
BluetoothSummaryUpdater mSummaryUpdater;
public SummaryProvider(Context context, SummaryLoader summaryLoader,
LocalBluetoothManager bluetoothManager) {
mBluetoothManager = bluetoothManager;
mContext = context;
mSummaryLoader = summaryLoader;
mSummaryHelper = new BluetoothSummaryHelper(mContext, mBluetoothManager);
mSummaryHelper.setOnSummaryChangeListener(this);
mSummaryUpdater = new BluetoothSummaryUpdater(mContext, this, mBluetoothManager);
}
@Override
public void setListening(boolean listening) {
mSummaryHelper.setListening(listening);
mSummaryUpdater.register(listening);
}
@Override