Java Code Examples for android.widget.Switch#setOnCheckedChangeListener()

The following examples show how to use android.widget.Switch#setOnCheckedChangeListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwitchPreference.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
/**
 * Clear listener in Switch for specify ViewGroup.
 *
 * @param viewGroup The ViewGroup that will need to clear the listener.
 */
private void clearListenerInViewGroup(final ViewGroup viewGroup) {
    if (null == viewGroup) {
        return;
    }

    int count = viewGroup.getChildCount();
    for(int n = 0; n < count; ++n) {
        View childView = viewGroup.getChildAt(n);
        if(childView instanceof Switch) {
            final Switch switchView = (Switch) childView;
            switchView.setOnCheckedChangeListener(null);
            return;
        } else if (childView instanceof ViewGroup){
            ViewGroup childGroup = (ViewGroup)childView;
            clearListenerInViewGroup(childGroup);
        }
    }
}
 
Example 2
Source File: ToggleElement.java    From debugdrawer with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup root) {
    final Context context = root.getContext();
    checked = new BooleanPreference(
        context.getSharedPreferences(getKey(),Context.MODE_PRIVATE),
        getTitle(),
        String.valueOf(defaultValue));
    if(!checked.isSet()) checked.set(defaultValue);

    aSwitch = new Switch(new ContextThemeWrapper(context, R.style.Widget_U2020_DebugDrawer_RowWidget));
    aSwitch.setText(title);
    aSwitch.setChecked(checked.get());
    aSwitch.setEnabled(isEnabled());
    aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            checked.set(isChecked);
            onSwitch(isChecked);
        }
    });
    aSwitch.setGravity(Gravity.START | Gravity.END | Gravity.CENTER_VERTICAL); // "start|end|center_vertical"
    return aSwitch;
}
 
Example 3
Source File: CustomSwitchPreference.java    From NightWidget with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Clear listener in Switch for specify ViewGroup.
 *
 * @param viewGroup The ViewGroup that will need to clear the listener.
 */
private void clearListenerInViewGroup(ViewGroup viewGroup) {
    if (null == viewGroup) {
        return;
    }

    int count = viewGroup.getChildCount();
    for(int n = 0; n < count; ++n) {
        View childView = viewGroup.getChildAt(n);
        if(childView instanceof Switch) {
            final Switch switchView = (Switch) childView;
            switchView.setOnCheckedChangeListener(null);
            return;
        } else if (childView instanceof ViewGroup){
            ViewGroup childGroup = (ViewGroup)childView;
            clearListenerInViewGroup(childGroup);
        }
    }
}
 
Example 4
Source File: FormBindings.java    From SimpleFTP with MIT License 6 votes vote down vote up
/**
 * Binding method for Switch
 * @param view The Switch widget.
 * @param observable The field value.
 */
@BindingAdapter("binding")
public static void bindSwitch(Switch view, final FieldViewModel<Boolean> observable) {
    if (view.getTag() == null) {
        view.setTag(true);
        view.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                observable.set(isChecked);
            }
        });
    }

    boolean newValue = observable.get() == null ? false : observable.get().booleanValue();
    if (view.isChecked() != newValue) {
        view.setChecked(newValue);
    }

    String newError = observable.getError();
    if (view.getError() != newError) {
        view.setError(newError);
    }
}
 
Example 5
Source File: MapFragment.java    From MapForTour with MIT License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_map, container, false);
    // Inflate the layout for this fragment
    switchLocation = (Switch) view.findViewById(R.id.switchLocation);
    switchLBSTrace = (Switch) view.findViewById(R.id.switchLBSTrace);
    switchLocation.setOnCheckedChangeListener(this);
    switchLBSTrace.setOnCheckedChangeListener(this);
    mMapView = (TextureMapView) view.findViewById(R.id.bmapView);
    baiduMap = mMapView.getMap();
    baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, false, null));
    application.setMaxZoomLevel(baiduMap.getMaxZoomLevel());
    // 开启定位图层
    baiduMap.setMyLocationEnabled(true);
    baiduMap.setOnMarkerClickListener(this);
    //再次进入地图fragment时界面刷新
    if (application.latLng != null) {
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(application.getLatLng(), application.getMaxZoomLevel() - 2);
        baiduMap.animateMapStatus(u);//动画移动摄像头
        if (radarNearbyInfoList != null) {
            refreshMapUI();
        }
    }
    return view;
}
 
Example 6
Source File: LaboratoryFragment.java    From easyweather with MIT License 6 votes vote down vote up
public void switchStatus(Switch aSwitch, final String fileName) {
    aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SharedPreferences settings = getActivity().getSharedPreferences(fileName, Context.MODE_PRIVATE);
            SharedPreferences.Editor edit = settings.edit();
            edit.putBoolean("ischecked", isChecked);
            edit.commit();

            if (isChecked) {
                initNightView(R.layout.night_mode_overlay);
            } else {
                removeNightView();
            }
        }

    });
}
 
Example 7
Source File: CustomSwitchPreference.java    From 600SeriesAndroidUploader with MIT License 6 votes vote down vote up
/**
 * Clear listener in Switch for specify ViewGroup.
 *
 * @param viewGroup The ViewGroup that will need to clear the listener.
 */
private void clearListenerInViewGroup(ViewGroup viewGroup) {
    if (null == viewGroup) {
        return;
    }

    int count = viewGroup.getChildCount();
    for(int n = 0; n < count; ++n) {
        View childView = viewGroup.getChildAt(n);
        if(childView instanceof Switch) {
            final Switch switchView = (Switch) childView;
            switchView.setOnCheckedChangeListener(null);
            return;
        } else if (childView instanceof ViewGroup){
            ViewGroup childGroup = (ViewGroup)childView;
            clearListenerInViewGroup(childGroup);
        }
    }
}
 
Example 8
Source File: SettingsFragment.java    From block-this with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    prefs = getActivity().getSharedPreferences(
            "com.savageorgiev.blockthis", Context.MODE_PRIVATE);

    v = inflater.inflate(R.layout.fragment_settings, container, false);
    switchAuto = (Switch) v.findViewById(R.id.switch_auto_start);

    int autoload = prefs.getInt("autoload", 0);
    if (autoload == 1) {
        switchAuto.setChecked(true);
    }

    switchAuto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked){
                prefs.edit().putInt("autoload", 1).apply();
            } else {
                prefs.edit().putInt("autoload", 0).apply();
            }
        }
    });

    return v;
}
 
Example 9
Source File: DebugPanel.java    From RhythmSticks with Apache License 2.0 5 votes vote down vote up
private void setupEnabledSwitch() {
  Switch enabledSwitch = (Switch) findViewById(R.id.debug_enabled);
  enabledSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      setEnabled(isChecked);
    }
  });
}
 
Example 10
Source File: FloatingModMenuService.java    From FloatingModMenu with GNU General Public License v3.0 5 votes vote down vote up
private void addSwitch(String name, final SW listner) {
    Switch sw = new Switch(this);
    sw.setText(name);
    sw.setTextColor(Color.WHITE);
    //sw.setTextSize(dipToPixels());
    sw.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            listner.OnWrite(isChecked);
        }
    });
    patches.addView(sw);
}
 
Example 11
Source File: SettingsActivity.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
private void setupSettingsSwitch(int containerId, int labelId, int switchId, boolean checked,
        CompoundButton.OnCheckedChangeListener checkedChangeListener) {
    ViewGroup container = findViewById(containerId);
    String switchLabel = ((TextView) container.findViewById(labelId)).getText().toString();
    final Switch switchView = container.findViewById(switchId);
    switchView.setContentDescription(switchLabel);
    switchView.setChecked(checked);
    container.setOnClickListener((view) -> switchView.performClick());
    switchView.setOnCheckedChangeListener(checkedChangeListener);
}
 
Example 12
Source File: BooleanOptionItem.java    From msdkui-android with Apache License 2.0 5 votes vote down vote up
private void init(final Context context) {
    LayoutInflater.from(context)
            .inflate(R.layout.boolean_option_item, this);
    mLabelView = (TextView) findViewById(R.id.boolean_item_label);
    mValue = (Switch) findViewById(R.id.boolean_item_value);
    mValue.setOnCheckedChangeListener(this);
}
 
Example 13
Source File: DebugPanel.java    From RhythmSticks with Apache License 2.0 5 votes vote down vote up
private void setupShowVerticalSwitch() {
  Switch showVerticalSwitch = (Switch) findViewById(R.id.debug_show_vertical);
  showVerticalSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      setDrawVerticalLines(isChecked);
    }
  });
}
 
Example 14
Source File: BrightnessSkillViewFragment.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public ViewGroup onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    LinearLayout view = new LinearLayout(getContext());
    view.setOrientation(LinearLayout.VERTICAL);

    LinearLayout auto_layout = new LinearLayout(getContext());
    auto_layout.setOrientation(LinearLayout.HORIZONTAL);
    TextView tv_auto = new TextView(getContext());
    tv_auto.setText(getResources().getString(R.string.operation_brightness_desc_autobrightness));
    mIsAuto = new Switch(getContext());
    mIsAuto.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mBrightnessLevel = new SeekBar(getContext());
    mBrightnessLevel.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mBrightnessLevel.setMax(255);
    mBrightnessLevel.setEnabled(false);
    mIsAuto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                mBrightnessLevel.setEnabled(false);
            else
                mBrightnessLevel.setEnabled(true);
        }
    });
    auto_layout.addView(mIsAuto);
    auto_layout.addView(tv_auto);

    view.addView(auto_layout);
    view.addView(mBrightnessLevel);

    return view;
}
 
Example 15
Source File: BaseSet.java    From MainScreenShow with GNU General Public License v2.0 5 votes vote down vote up
/**
 * show Switch Bubble 变色
 *
 * @param convertView
 */
protected void showBubble_Color(View convertView) {

    if (sp_date
            .getString("animation" + VALUE, "")
            .equals(PropertiesUtils.getAnimationInfo(BaseSet.this)[C.ANIMATION_BUBBLE])) {
        TextView title_ = (TextView) convertView
                .findViewById(R.id.tv_msseventset_title_);
        TextView tip = (TextView) convertView
                .findViewById(R.id.tv_msseventset_tip);
        Switch sw = (Switch) convertView.findViewById(R.id.sw_msseventset);
        title_.setText(R.string.setting_bubble_changeColor);
        tip.setText(R.string.tip_bubble_color);
        sp_setA = getSharedPreferences(
                eventName
                        + PropertiesUtils.getAnimationInfo(BaseSet.this)[C.ANIMATION_BUBBLE],
                0);

        sw.setVisibility(View.VISIBLE);
        sw.setChecked(sp_setA.getBoolean("color", true));
        sw.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView,
                                         boolean isChecked) {

                sp_setA.edit().putBoolean("color", isChecked).commit();

            }
        });
    }
}
 
Example 16
Source File: CircleProgressBarActivity.java    From CircleProgressBar with Apache License 2.0 5 votes vote down vote up
private void initDial() {
    vDial = LayoutInflater.from(this).inflate(R.layout.include_circleprogressbar_dial,
            vgControl, false);
    RadioGroup rgVisibility = vDial.findViewById(R.id.cpb_rg_dial_visibility);
    rgVisibility.setOnCheckedChangeListener(this);
    SeekBar sbDialGap = vDial.findViewById(R.id.cpb_sb_dial_gap);
    sbDialGap.setOnSeekBarChangeListener(this);
    SeekBar sbDialAngle = vDial.findViewById(R.id.cpb_sb_dial_angle);
    sbDialAngle.setOnSeekBarChangeListener(this);
    SeekBar sbDialHeight = vDial.findViewById(R.id.cpb_sb_dial_height);
    sbDialHeight.setOnSeekBarChangeListener(this);
    SeekBar sbDialWidth = vDial.findViewById(R.id.cpb_sb_dial_width);
    sbDialWidth.setOnSeekBarChangeListener(this);
    SeekBar sbDialSpecialUnit = vDial.findViewById(R.id.cpb_sb_dial_special_unit);
    sbDialSpecialUnit.setOnSeekBarChangeListener(this);
    SeekBar sbDialSpecialHeight = vDial.findViewById(R.id.cpb_sb_dial_special_height);
    sbDialSpecialHeight.setOnSeekBarChangeListener(this);
    SeekBar sbDialSpecialWidth = vDial.findViewById(R.id.cpb_sb_dial_special_width);
    sbDialSpecialWidth.setOnSeekBarChangeListener(this);
    RadioGroup rgDialGravity = vDial.findViewById(R.id.cpb_rg_dial_gravity);
    rgDialGravity.setOnCheckedChangeListener(this);
    Switch stSpecialDialValue = vDial.findViewById(R.id.cpb_st_special_dial_value);
    stSpecialDialValue.setOnCheckedChangeListener(this);
    SeekBar sbSpecialDialValueGap = vDial.findViewById(R.id.cpb_sb_special_dial_value_gap);
    sbSpecialDialValueGap.setOnSeekBarChangeListener(this);
    SeekBar sbSpecialDialValueTextSize =
            vDial.findViewById(R.id.cpb_sb_special_dial_value_text_size);
    sbSpecialDialValueTextSize.setOnSeekBarChangeListener(this);
}
 
Example 17
Source File: OBooleanField.java    From framework with GNU Affero General Public License v3.0 4 votes vote down vote up
public void initControl() {
    mReady = false;
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    removeAllViews();
    setOrientation(VERTICAL);
    if (isEditable()) {
        if (mWidget != null) {
            switch (mWidget) {
                case Switch:
                    mSwitch = new Switch(mContext);
                    mSwitch.setLayoutParams(params);
                    mSwitch.setOnCheckedChangeListener(this);
                    setValue(getValue());
                    if (mLabel != null)
                        mSwitch.setText(mLabel);
                    if (textSize > -1) {
                        mSwitch.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
                    }
                    if (appearance > -1) {
                        mSwitch.setTextAppearance(mContext, appearance);
                    }
                    mSwitch.setTextColor(textColor);
                    addView(mSwitch);
                    break;
                default:
                    break;
            }
        } else {
            mCheckbox = new CheckBox(mContext);
            mCheckbox.setLayoutParams(params);
            mCheckbox.setOnCheckedChangeListener(this);
            if (mLabel != null)
                mCheckbox.setText(mLabel);
            if (textSize > -1) {
                mCheckbox.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
            }
            if (appearance > -1) {
                mCheckbox.setTextAppearance(mContext, appearance);
            }
            mCheckbox.setTextColor(textColor);
            addView(mCheckbox);
        }
    } else {
        txvView = new TextView(mContext);
        txvView.setLayoutParams(params);
        txvView.setText(getCheckBoxLabel());
        if (mLabel != null)
            txvView.setText(mLabel);
        if (textSize > -1) {
            txvView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
        }
        if (appearance > -1) {
            txvView.setTextAppearance(mContext, appearance);
        }
        addView(txvView);
    }
}
 
Example 18
Source File: ErrorsActivity.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    if (mPrefs.getBoolean("wear_sync", false) && mPrefs.getBoolean("sync_wear_logs", false)) {
        startWatchUpdaterService(this, WatchUpdaterService.ACTION_SYNC_LOGS, TAG);
    }
    setContentView(R.layout.activity_errors);

    highCheckboxView = (CheckBox) findViewById(R.id.highSeverityCheckbox);
    mediumCheckboxView = (CheckBox) findViewById(R.id.midSeverityCheckbox);
    lowCheckboxView = (CheckBox) findViewById(R.id.lowSeverityCheckBox);
    userEventLowCheckboxView = (CheckBox) findViewById(R.id.userEventLowCheckbox);
    userEventHighCheckboxView = (CheckBox) findViewById(R.id.userEventHighCheckbox);
    autoRefreshSwitch = (Switch) findViewById(R.id.autorefresh);

    highCheckboxView.setOnClickListener(checkboxListener);
    mediumCheckboxView.setOnClickListener(checkboxListener);
    lowCheckboxView.setOnClickListener(checkboxListener);
    userEventLowCheckboxView.setOnClickListener(checkboxListener);
    userEventHighCheckboxView.setOnClickListener(checkboxListener);

    autoRefreshSwitch.setOnCheckedChangeListener(switchChangeListener);


    Intent intent = getIntent();
    if (intent != null) {
        final Bundle bundle = intent.getExtras();
        if (bundle != null) {
            final String str = bundle.getString("events");
            if (str != null) {
                userEventHighCheckboxView.setChecked(true);
                userEventLowCheckboxView.setChecked(PersistentStore.getBoolean("events-userlowcheckbox"));
                mediumCheckboxView.setChecked(PersistentStore.getBoolean("events-mediumcheckbox"));
                highCheckboxView.setChecked(PersistentStore.getBoolean("events-highcheckbox"));
                lowCheckboxView.setChecked(PersistentStore.getBoolean("events-lowcheckbox"));
            }
        }
    }


    updateErrors();
    errorList = (ListView) findViewById(R.id.errorList);
    adapter = new ErrorListAdapter(getApplicationContext(), errors);
    errorList.setAdapter(adapter);
}
 
Example 19
Source File: AuthenticatorActivity.java    From kolabnotes-android with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_kolab_login);
    mAccountManager = AccountManager.get(getBaseContext());

    findViewById(R.id.submit).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            submit();
        }
    });

    mPortView = (EditText) findViewById(R.id.port_number);
    mEnableSSLView = (CheckBox) findViewById(R.id.enable_ssl);
    mSyncView = (EditText) findViewById(R.id.sync_intervall);
    mKolabView = (Switch) findViewById(R.id.enable_kolab);
    mSharedFoldersView = (Switch) findViewById(R.id.enable_shared_folders);
    mRootFolderView = (EditText)findViewById(R.id.imap_root_folder);
    mIMAPServerView = (EditText)findViewById(R.id.imap_server_url);
    mAccountType = (Spinner)findViewById(R.id.spinner_accountType);
    mIntervallType = (Spinner)findViewById(R.id.spinner_intervall);

    mAccountNameView = (EditText)findViewById(R.id.accountName);
    mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
    mPasswordView = (EditText) findViewById(R.id.accountPassword);

    mExtendedOptions = (Switch) findViewById(R.id.enable_more_config);
    mExtendedOptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if(b){
               showExtendedOptions();
            }else{
                hideExtendedOptions();
            }
        }
    });

    initAccountTypeSpinner();
    initIntervallSpinner();

    hideExtendedOptions();

    startIntent = getIntent();
    if(startIntent != null && startIntent.getBooleanExtra("changeAccount",false)){
        ActiveAccountRepository accountRepo = new ActiveAccountRepository(this);
        ActiveAccount activeAccount = accountRepo.getActiveAccount();
        if(activeAccount.getAccount().equals("local") && activeAccount.getRootFolder().equals("Notes")) {
            Toast.makeText(this,R.string.local_account_change,Toast.LENGTH_LONG).show();
            finish();
        }else {
            initViews(activeAccount.getAccount(), activeAccount.getRootFolder());
        }
    }
}
 
Example 20
Source File: TouchWiz.java    From SystemUITuner2 with MIT License 4 votes vote down vote up
private void setupSwitches() {
    Switch high_brightness_warning = view.findViewById(R.id.high_brightness_warning);

    Switch knox_container = view.findViewById(R.id.knox_container);
    Switch smart_network = view.findViewById(R.id.smart_network);
    Switch glove = view.findViewById(R.id.glove);
    Switch gesture = view.findViewById(R.id.gesture);
    Switch smart_scroll = view.findViewById(R.id.smart_scroll);
    Switch face = view.findViewById(R.id.face);
    Switch gps = view.findViewById(R.id.gps);
    Switch lbs = view.findViewById(R.id.lbs);
    Switch wearable_gear = view.findViewById(R.id.wearable_gear);
    Switch femtoicon = view.findViewById(R.id.femtoicon);
    Switch rcs = view.findViewById(R.id.rcs);
    Switch wifi_p2p = view.findViewById(R.id.wifi_p2p);
    Switch wifi_ap = view.findViewById(R.id.wifi_ap);
    Switch wifi_oxygen = view.findViewById(R.id.wifi_oxygen);
    Switch phone_signal_second_stub = view.findViewById(R.id.phone_signal_second_stub);
    Switch toddler = view.findViewById(R.id.toddler);
    Switch ims_volte = view.findViewById(R.id.ims_volte);
    Switch keyguard_wakeup = view.findViewById(R.id.keyguard_wakeup);
    Switch safezone = view.findViewById(R.id.safezone);
    Switch wimax = view.findViewById(R.id.wimax);
    Switch smart_bonding = view.findViewById(R.id.smart_bonding);
    Switch private_mode = view.findViewById(R.id.private_mode);

    switches.add(knox_container);
    switches.add(smart_network);
    switches.add(glove);
    switches.add(gesture);
    switches.add(smart_scroll);
    switches.add(face);
    switches.add(gps);
    switches.add(lbs);
    switches.add(wearable_gear);
    switches.add(femtoicon);
    switches.add(rcs);
    switches.add(wifi_p2p);
    switches.add(wifi_ap);
    switches.add(wifi_oxygen);
    switches.add(phone_signal_second_stub);
    switches.add(toddler);
    switches.add(ims_volte);
    switches.add(keyguard_wakeup);
    switches.add(safezone);
    switches.add(wimax);
    switches.add(smart_bonding);
    switches.add(private_mode);

    high_brightness_warning.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            activity.setThings.settings(GLOBAL, "limit_brightness_state", isChecked ? "80, 80" : null);
        }
    });

    activity.setThings.switches(knox_container, SLOT_KNOX_CONTAINER, ICON_BLACKLIST, view);
    activity.setThings.switches(smart_network, SLOT_SMART_NETWORK, ICON_BLACKLIST, view);
    activity.setThings.switches(glove, SLOT_GLOVE, ICON_BLACKLIST, view);
    activity.setThings.switches(gesture, SLOT_GESTURE, ICON_BLACKLIST, view);
    activity.setThings.switches(smart_scroll, SLOT_SMART_SCROLL, ICON_BLACKLIST, view);
    activity.setThings.switches(face, SLOT_FACE, ICON_BLACKLIST, view);
    activity.setThings.switches(gps, SLOT_GPS, ICON_BLACKLIST, view);
    activity.setThings.switches(lbs, SLOT_LBS, ICON_BLACKLIST, view);
    activity.setThings.switches(wearable_gear, SLOT_WEARABLE_GEAR, ICON_BLACKLIST, view);
    activity.setThings.switches(femtoicon, SLOT_FEMTOICON, ICON_BLACKLIST, view);
    activity.setThings.switches(rcs, SLOT_RCS, ICON_BLACKLIST, view);
    activity.setThings.switches(wifi_p2p, SLOT_WIFI_P2P, ICON_BLACKLIST, view);
    activity.setThings.switches(wifi_ap, SLOT_WIFI_AP, ICON_BLACKLIST, view);
    activity.setThings.switches(wifi_oxygen, SLOT_WIFI_OXYGEN, ICON_BLACKLIST, view);
    activity.setThings.switches(phone_signal_second_stub, SLOT_PHONE_SIGNAL_SECOND_STUB, ICON_BLACKLIST, view);
    activity.setThings.switches(toddler, SLOT_TODDLER, ICON_BLACKLIST, view);
    activity.setThings.switches(ims_volte, SLOT_IMS_VOLTE, ICON_BLACKLIST, view);
    activity.setThings.switches(keyguard_wakeup, SLOT_KEYGUARD_WAKEUP, ICON_BLACKLIST, view);
    activity.setThings.switches(safezone, SLOT_SAFEZONE, ICON_BLACKLIST, view);
    activity.setThings.switches(wimax, SLOT_WIMAX, ICON_BLACKLIST, view);
    activity.setThings.switches(smart_bonding, SLOT_SMART_BONDING, ICON_BLACKLIST, view);
    activity.setThings.switches(private_mode, SLOT_PRIVATE_MODE, ICON_BLACKLIST, view);
}