code: private void init(Context context) {
          setDialogWindowAttributes();
          // Listen for the backpress in order to dismiss the dialog with animation
          setOnKeyListener(new OnKeyListener() {
              @Override
              public boolean onKey(DialogInterface arg0, int keyCode, KeyEvent event) {
                  if (keyCode == KeyEvent.KEYCODE_BACK) {
                      slideClose();
                  }
                  return true;
              }
          });
      }
docs: ------------------Private methods------------------//