use of com.android.settings.widget.MasterSwitchController in project android_packages_apps_Settings by crdroidandroid.
the class BluetoothEnablerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mBluetoothManager.getBluetoothAdapter()).thenReturn(mBluetoothAdapter);
mSwitch = new Switch(mContext);
mMasterSwitchPreference = new MasterSwitchPreference(mContext);
mMasterSwitchController = spy(new MasterSwitchController(mMasterSwitchPreference));
mBluetoothEnabler = new BluetoothEnabler(mContext, mMasterSwitchController, mMetricsFeatureProvider, mBluetoothManager, 123, mRestrictionUtils);
PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(mock(View.class));
when(holder.findViewById(R.id.switchWidget)).thenReturn(mSwitch);
mMasterSwitchPreference.onBindViewHolder(holder);
}
use of com.android.settings.widget.MasterSwitchController in project android_packages_apps_Settings by SudaMod.
the class AutomaticStorageManagementSwitchPreferenceController method onResume.
@Override
public void onResume() {
if (!isAvailable()) {
return;
}
boolean isStorageManagerEnabled = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, 0) != 0;
mSwitch.setChecked(isStorageManagerEnabled);
if (mSwitch != null) {
mSwitchController = new MasterSwitchController(mSwitch);
mSwitchController.setListener(this);
mSwitchController.startListening();
}
}
use of com.android.settings.widget.MasterSwitchController in project android_packages_apps_Settings by SudaMod.
the class BluetoothEnablerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mBluetoothManager.getBluetoothAdapter()).thenReturn(mBluetoothAdapter);
mSwitch = new Switch(mContext);
mMasterSwitchPreference = new MasterSwitchPreference(mContext);
mMasterSwitchController = spy(new MasterSwitchController(mMasterSwitchPreference));
mBluetoothEnabler = new BluetoothEnabler(mContext, mMasterSwitchController, mMetricsFeatureProvider, mBluetoothManager, 123, mRestrictionUtils);
PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(mock(View.class));
when(holder.findViewById(R.id.switchWidget)).thenReturn(mSwitch);
mMasterSwitchPreference.onBindViewHolder(holder);
}
use of com.android.settings.widget.MasterSwitchController in project android_packages_apps_Settings by DirtyUnicorns.
the class BluetoothEnablerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mBluetoothManager.getBluetoothAdapter()).thenReturn(mBluetoothAdapter);
mSwitch = new Switch(mContext);
mMasterSwitchPreference = new MasterSwitchPreference(mContext);
mMasterSwitchController = spy(new MasterSwitchController(mMasterSwitchPreference));
mBluetoothEnabler = new BluetoothEnabler(mContext, mMasterSwitchController, mMetricsFeatureProvider, mBluetoothManager, 123, mRestrictionUtils);
PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(mock(View.class));
when(holder.findViewById(R.id.switchWidget)).thenReturn(mSwitch);
mMasterSwitchPreference.onBindViewHolder(holder);
}
use of com.android.settings.widget.MasterSwitchController in project platform_packages_apps_Settings by BlissRoms.
the class BluetoothEnablerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mBluetoothManager.getBluetoothAdapter()).thenReturn(mBluetoothAdapter);
mSwitch = new Switch(mContext);
mMasterSwitchPreference = new MasterSwitchPreference(mContext);
mMasterSwitchController = spy(new MasterSwitchController(mMasterSwitchPreference));
mBluetoothEnabler = new BluetoothEnabler(mContext, mMasterSwitchController, mMetricsFeatureProvider, mBluetoothManager, 123, mRestrictionUtils);
PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(mock(View.class));
when(holder.findViewById(R.id.switchWidget)).thenReturn(mSwitch);
mMasterSwitchPreference.onBindViewHolder(holder);
}
Aggregations