docs: @Nullable
    private static ScaleType getScaleTypeFromXml(
        TypedArray gdhAttrs,
        int attrId) {
      switch (gdhAttrs.getInt(attrId, -2)) {
        case -1: // none
          return null;
        case 0: // fitXY
          return ScaleType.FIT_XY;
        case 1: // fitStart
          return ScaleType.FIT_START;
        case 2: // fitCenter
          return ScaleType.FIT_CENTER;
        case 3: // fitEnd
          return ScaleType.FIT_END;
        case 4: // center
          return ScaleType.CENTER;
        case 5: // centerInside
          return ScaleType.CENTER_INSIDE;
        case 6: // centerCrop
          return ScaleType.CENTER_CROP;
        case 7: // focusCrop
          return ScaleType.FOCUS_CROP;
        case 8: // fitBottomStart
          return ScaleType.FIT_BOTTOM_START;
        default:
          // this method is supposed to be called only when XML attribute is specified.
          throw new RuntimeException("XML attribute not specified!");
      }
    }