Search in sources :

Example 11 with MasterSwitchController

use of com.android.settings.widget.MasterSwitchController in project platform_packages_apps_Settings by BlissRoms.

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