@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
  @Override
  protected void onBindView(View view) {
    super.onBindView(view);

    View checkableView = view.findViewById(R.id.switchWidget);
    if (checkableView != null && checkableView instanceof Checkable) {
      ((Checkable) checkableView).setChecked(mChecked);
      if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        if (checkableView instanceof Switch) {
          final Switch switchView = (Switch) checkableView;
          switchView.setTextOn(mSwitchOn);
          switchView.setTextOff(mSwitchOff);
          switchView.setOnCheckedChangeListener(mListener);
        }
      } else {
        if (checkableView instanceof android.widget.Switch) {
          final android.widget.Switch switchView = (android.widget.Switch) checkableView;
          switchView.setTextOn(mSwitchOn);
          switchView.setTextOff(mSwitchOff);
          switchView.setOnCheckedChangeListener(mListener);
        }
      }
    }

    syncSummaryView(view);
  }
 @Override
 protected void onBindView(View view) {
   super.onBindView(view);
   View checkboxView = view.findViewById(android.R.id.checkbox);
   if (checkboxView != null && checkboxView instanceof Checkable)
     ((Checkable) checkboxView).setChecked(mChecked);
   syncSummaryView(view);
 }
 @Override
 protected void onBindView(View view) {
   super.onBindView(view);
   View checkableView = view.findViewById(R.id.switchWidget);
   if (checkableView != null && checkableView instanceof Checkable) {
     ((Checkable) checkableView).setChecked(mChecked);
     sendAccessibilityEvent(checkableView);
     if (checkableView instanceof Switch) {
       final Switch switchView = (Switch) checkableView;
       switchView.setTextOn(mSwitchOn);
       switchView.setTextOff(mSwitchOff);
       switchView.setOnCheckedChangeListener(mListener);
     }
   }
   syncSummaryView(view);
 }
 @Override
 protected void init(
     final Context context,
     final AttributeSet attrs,
     final int defStyleAttr,
     final int defStyleRes) {
   super.init(context, attrs, defStyleAttr, defStyleRes);
   setWidgetLayoutResource(R.layout.mpl__preference_widget_checkbox);
   final TypedArray a =
       context.obtainStyledAttributes(
           attrs, R.styleable.CheckBoxPreference, defStyleAttr, defStyleRes);
   setSummaryOn(a.getString(R.styleable.CheckBoxPreference_summaryOn));
   setSummaryOff(a.getString(R.styleable.CheckBoxPreference_summaryOff));
   setDisableDependentsState(
       a.getBoolean(R.styleable.CheckBoxPreference_disableDependentsState, false));
   a.recycle();
 }