code: private void adaptSwitch() {
          if (switchWidget != null) {
              switchWidget.setTextOn(getSwitchTextOn());
              switchWidget.setTextOff(getSwitchTextOff());
              switchWidget.setShowText(!TextUtils.isEmpty(getSwitchTextOn()) ||
                      !TextUtils.isEmpty(getSwitchTextOff()));
              switchWidget.setChecked(isChecked());
          }
      }
docs: Adapts the preference's switch, depending on the preference's properties and on whether it is
  currently checked or not.