code: private void obtainMargin(@StyleRes final int themeResourceId) {
          TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId,
                  new int[]{R.attr.materialDialogMarginLeft, R.attr.materialDialogMarginTop,
                          R.attr.materialDialogMarginRight, R.attr.materialDialogMarginBottom});
          int defaultHorizontalMargin =
                  getContext().getResources().getDimensionPixelSize(R.dimen.dialog_horizontal_margin);
          int defaultVerticalMargin =
                  getContext().getResources().getDimensionPixelSize(R.dimen.dialog_vertical_margin);
          int left = typedArray.getDimensionPixelSize(0, defaultHorizontalMargin);
          int top = typedArray.getDimensionPixelSize(1, defaultVerticalMargin);
          int right = typedArray.getDimensionPixelSize(2, defaultHorizontalMargin);
          int bottom = typedArray.getDimensionPixelSize(3, defaultVerticalMargin);
          setMargin(left, top, right, bottom);
      }
docs: Obtains the margin from a specific theme.
  
  @param themeResourceId
  The resource id of the theme, the margin should be obtained from, as an {@link
  Integer} value