Use SettingsLib's MainSwitchBar to replace SwitchBar in Settings.
To log Settings metrics, the MainSwitch extends MainSwitchBar and replace the SwitchBar in SettingsActivity. Bug: 175181773 Test: Run robotest and apply the widget in Settings and see the ui Change-Id: I3add3702e9058ad9192b5172c7cf0e2ccfb55a70
This commit is contained in:
@@ -49,8 +49,8 @@ import com.android.settings.network.TetherEnabler;
|
||||
import com.android.settings.network.UsbTetherPreferenceController;
|
||||
import com.android.settings.network.WifiTetherDisablePreferenceController;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.widget.SwitchBar;
|
||||
import com.android.settings.widget.SwitchBarController;
|
||||
import com.android.settings.widget.MainSwitchBarController;
|
||||
import com.android.settings.widget.SettingsMainSwitchBar;
|
||||
import com.android.settings.wifi.tether.WifiTetherApBandPreferenceController;
|
||||
import com.android.settings.wifi.tether.WifiTetherAutoOffPreferenceController;
|
||||
import com.android.settings.wifi.tether.WifiTetherBasePreferenceController;
|
||||
@@ -227,15 +227,15 @@ public class AllInOneTetherSettings extends RestrictedDashboardFragment
|
||||
adapter.getProfileProxy(activity.getApplicationContext(), mProfileServiceListener,
|
||||
BluetoothProfile.PAN);
|
||||
}
|
||||
final SwitchBar switchBar = activity.getSwitchBar();
|
||||
final SettingsMainSwitchBar mainSwitch = activity.getSwitchBar();
|
||||
mTetherEnabler = new TetherEnabler(activity,
|
||||
new SwitchBarController(switchBar), mBluetoothPan);
|
||||
new MainSwitchBarController(mainSwitch), mBluetoothPan);
|
||||
getSettingsLifecycle().addObserver(mTetherEnabler);
|
||||
use(UsbTetherPreferenceController.class).setTetherEnabler(mTetherEnabler);
|
||||
use(BluetoothTetherPreferenceController.class).setTetherEnabler(mTetherEnabler);
|
||||
use(EthernetTetherPreferenceController.class).setTetherEnabler(mTetherEnabler);
|
||||
use(WifiTetherDisablePreferenceController.class).setTetherEnabler(mTetherEnabler);
|
||||
switchBar.show();
|
||||
mainSwitch.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user