@Override
 public void onClick(DialogInterface dialog, int which) {
   final boolean checked;
   switch (which) {
     case DialogInterface.BUTTON_POSITIVE:
       checked = (mShownDialogId == DIALOG_ID_ENABLE_WARNING);
       mToggleSwitch.setCheckedInternal(checked);
       getArguments().putBoolean(EXTRA_CHECKED, checked);
       onPreferenceToggled(mPreferenceKey, checked);
       break;
     case DialogInterface.BUTTON_NEGATIVE:
       checked = (mShownDialogId == DIALOG_ID_DISABLE_WARNING);
       mToggleSwitch.setCheckedInternal(checked);
       getArguments().putBoolean(EXTRA_CHECKED, checked);
       onPreferenceToggled(mPreferenceKey, checked);
       break;
     default:
       throw new IllegalArgumentException();
   }
 }
    private void processArguments() {
      Bundle arguments = getArguments();

      // Key.
      mPreferenceKey = arguments.getString(EXTRA_PREFERENCE_KEY);

      // Enabled.
      final boolean enabled = arguments.getBoolean(EXTRA_CHECKED);
      mToggleSwitch.setCheckedInternal(enabled);

      // Title.
      PreferenceActivity activity = (PreferenceActivity) getActivity();
      if (!activity.onIsMultiPane() || activity.onIsHidingHeaders()) {
        mOldActivityTitle = getActivity().getTitle();
        String title = arguments.getString(EXTRA_TITLE);
        getActivity().getActionBar().setTitle(title);
      }

      // Summary.
      String summary = arguments.getString(EXTRA_SUMMARY);
      mSummaryPreference.setSummary(summary);

      // Settings title and intent.
      String settingsTitle = arguments.getString(EXTRA_SETTINGS_TITLE);
      String settingsComponentName = arguments.getString(EXTRA_SETTINGS_COMPONENT_NAME);
      if (!TextUtils.isEmpty(settingsTitle) && !TextUtils.isEmpty(settingsComponentName)) {
        Intent settingsIntent =
            new Intent(Intent.ACTION_MAIN)
                .setComponent(ComponentName.unflattenFromString(settingsComponentName.toString()));
        if (!getPackageManager().queryIntentActivities(settingsIntent, 0).isEmpty()) {
          mSettingsTitle = settingsTitle;
          mSettingsIntent = settingsIntent;
          setHasOptionsMenu(true);
        }
      }

      // Enable warning title.
      mEnableWarningTitle =
          arguments.getCharSequence(AccessibilitySettings.EXTRA_ENABLE_WARNING_TITLE);

      // Enable warning message.
      mEnableWarningMessage =
          arguments.getCharSequence(AccessibilitySettings.EXTRA_ENABLE_WARNING_MESSAGE);

      // Disable warning title.
      mDisableWarningTitle = arguments.getString(AccessibilitySettings.EXTRA_DISABLE_WARNING_TITLE);

      // Disable warning message.
      mDisableWarningMessage =
          arguments.getString(AccessibilitySettings.EXTRA_DISABLE_WARNING_MESSAGE);
    }