code: private void initializeShowCustomDialogPreference() {
          Preference preference =
                  findPreference(getString(R.string.show_custom_dialog_preference_key));
          preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
  
              @Override
              public boolean onPreferenceClick(final Preference preference) {
                  initializeCustomDialog();
                  customDialog.setShowAnimation(createRectangularRevealAnimation(preference));
                  customDialog.setDismissAnimation(createRectangularRevealAnimation(preference));
                  customDialog.setCancelAnimation(createRectangularRevealAnimation(preference));
                  customDialog.show();
                  return true;
              }
  
          });
      }
docs: Initializes the preference, which allows to show the custom dialog.