private void updateBackgroundDrawableAttrs(boolean convert) { if (mutateBackground) { if (convert) { mBackgroundDrawable = RoundedDrawable.fromDrawable(mBackgroundDrawable); } updateAttrs(mBackgroundDrawable); } }
private void updateAttrs(Drawable drawable) { if (drawable == null) { return; } if (drawable instanceof RoundedDrawable) { ((RoundedDrawable) drawable) .setScaleType(mScaleType) .setCornerRadius(cornerRadius) .setBorderWidth(borderWidth) .setBorderColor(borderColor) .setOval(isOval); } 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 updateDrawableAttrs() { updateAttrs(mDrawable); }