Search in sources :

Example 6 with MasterSwitchController

use of com.android.settings.widget.MasterSwitchController in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AutomaticStorageManagementSwitchPreferenceController method onResume.

@Override
public void onResume() {
    if (!isAvailable()) {
        return;
    }
    mSwitch.setChecked(Utils.isStorageManagerEnabled(mContext));
    if (mSwitch != null) {
        mSwitchController = new MasterSwitchController(mSwitch);
        mSwitchController.setListener(this);
        mSwitchController.startListening();
    }
}
Also used : MasterSwitchController(com.android.settings.widget.MasterSwitchController)

Example 7 with MasterSwitchController

use of com.android.settings.widget.MasterSwitchController in project android_packages_apps_Settings by LineageOS.

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();
    }
}
Also used : MasterSwitchController(com.android.settings.widget.MasterSwitchController)

Example 8 with MasterSwitchController

use of com.android.settings.widget.MasterSwitchController in project android_packages_apps_Settings by LineageOS.

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);
}
Also used : MasterSwitchPreference(com.android.settings.widget.MasterSwitchPreference) Switch(android.widget.Switch) MasterSwitchController(com.android.settings.widget.MasterSwitchController) PreferenceViewHolder(android.support.v7.preference.PreferenceViewHolder) View(android.view.View) Before(org.junit.Before)

Example 9 with MasterSwitchController

use of com.android.settings.widget.MasterSwitchController in project android_packages_apps_Settings by DirtyUnicorns.

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();
    }
}
Also used : MasterSwitchController(com.android.settings.widget.MasterSwitchController)

Example 10 with MasterSwitchController

use of com.android.settings.widget.MasterSwitchController in project android_packages_apps_Settings by crdroidandroid.

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();
    }
}
Also used : MasterSwitchController(com.android.settings.widget.MasterSwitchController)

Aggregations

MasterSwitchController (com.android.settings.widget.MasterSwitchController)11 PreferenceViewHolder (android.support.v7.preference.PreferenceViewHolder)5 View (android.view.View)5 Switch (android.widget.Switch)5 MasterSwitchPreference (com.android.settings.widget.MasterSwitchPreference)5 Before (org.junit.Before)5