private void updateAttrs(Drawable drawable) {
    if (drawable == null) {
      return;
    }

    if (drawable instanceof RoundedDrawable) {
      ((RoundedDrawable) drawable)
          .setScaleType(mScaleType)
          .setBorderWidth(mBorderWidth)
          .setBorderColor(mBorderColor)
          .setOval(mIsOval)
          .setTileModeX(mTileModeX)
          .setTileModeY(mTileModeY);

      if (mCornerRadii != null) {
        ((RoundedDrawable) drawable)
            .setCornerRadius(
                mCornerRadii[CORNER_TOP_LEFT],
                mCornerRadii[CORNER_TOP_RIGHT],
                mCornerRadii[CORNER_BOTTOM_RIGHT],
                mCornerRadii[CORNER_BOTTOM_LEFT]);
      }

      applyColorMod();
    } else if (drawable instanceof LayerDrawable) {
      // loop through layers to and set drawable attrs
      LayerDrawable ld = ((LayerDrawable) drawable);
      for (int i = 0, layers = ld.getNumberOfLayers(); i < layers; i++) {
        updateAttrs(ld.getDrawable(i));
      }
    }
  }
 private void updateBackgroundDrawableAttrs(boolean convert) {
   if (mMutateBackground) {
     if (convert) {
       mBackgroundDrawable = RoundedDrawable.fromDrawable(mBackgroundDrawable);
     }
     updateAttrs(mBackgroundDrawable);
   }
 }
 private void updateDrawableAttrs() {
   updateAttrs(mDrawable);
 }