@Test @SdkSuppress(minSdkVersion = Build.VERSION_CODES.N) public void inflate() { RoundedDrawable roundedDrawable = (RoundedDrawable) mActivityRule.getActivity().getDrawable( R.drawable.rounded_drawable); assertEquals( mActivityRule.getActivity().getColor(R.color.rounded_drawable_background_color), roundedDrawable.getBackgroundColor()); assertTrue(roundedDrawable.isClipEnabled()); assertNotNull(roundedDrawable.getDrawable()); assertEquals(mActivityRule.getActivity().getResources().getDimensionPixelSize( R.dimen.rounded_drawable_radius), roundedDrawable.getRadius()); }
@Override public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException { super.inflate(r, parser, attrs, theme); TypedArray a = r.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.RoundedDrawable); if (a.hasValue(R.styleable.RoundedDrawable_android_src)) { setDrawable(a.getDrawable(R.styleable.RoundedDrawable_android_src)); } setRadius(a.getDimensionPixelSize(R.styleable.RoundedDrawable_radius, 0)); setClipEnabled(a.getBoolean(R.styleable.RoundedDrawable_clipEnabled, false)); setBackgroundColor( a.getColor(R.styleable.RoundedDrawable_backgroundColor, Color.TRANSPARENT)); a.recycle(); }
RoundedDrawable extends Drawable { @Override public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException { super.inflate(r, parser, attrs, theme); TypedArray a = r.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.RoundedDrawable); if (a.hasValue(R.styleable.RoundedDrawable_android_src)) { setDrawable(a.getDrawable(R.styleable.RoundedDrawable_android_src)); } setRadius(a.getDimensionPixelSize(R.styleable.RoundedDrawable_radius, 0)); setClipEnabled(a.getBoolean(R.styleable.RoundedDrawable_clipEnabled, false)); setBackgroundColor( a.getColor(R.styleable.RoundedDrawable_backgroundColor, Color.TRANSPARENT)); a.recycle(); } }
RoundedDrawable extends Drawable { @Override public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException { super.inflate(r, parser, attrs, theme); TypedArray a = r.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.RoundedDrawable); if (a.hasValue(R.styleable.RoundedDrawable_android_src)) { setDrawable(a.getDrawable(R.styleable.RoundedDrawable_android_src)); } setRadius(a.getDimensionPixelSize(R.styleable.RoundedDrawable_radius, 0)); setClipEnabled(a.getBoolean(R.styleable.RoundedDrawable_clipEnabled, false)); setBackgroundColor( a.getColor(R.styleable.RoundedDrawable_backgroundColor, Color.TRANSPARENT)); a.recycle(); } RoundedDrawable(); }
RoundedDrawable extends Drawable { @Override public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException { super.inflate(r, parser, attrs, theme); TypedArray a = r.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.RoundedDrawable); if (a.hasValue(R.styleable.RoundedDrawable_android_src)) { setDrawable(a.getDrawable(R.styleable.RoundedDrawable_android_src)); } setRadius(a.getDimensionPixelSize(R.styleable.RoundedDrawable_radius, 0)); setClipEnabled(a.getBoolean(R.styleable.RoundedDrawable_clipEnabled, false)); setBackgroundColor( a.getColor(R.styleable.RoundedDrawable_backgroundColor, Color.TRANSPARENT)); a.recycle(); } RoundedDrawable(); @Override void inflate(@NonNull Resources r, @NonNull XmlPullParser parser,
            @NonNull AttributeSet attrs, @Nullable Resources.Theme theme); void setDrawable(@Nullable Drawable drawable); @Nullable Drawable getDrawable(); void setBackgroundColor(@ColorInt int color); @ColorInt int getBackgroundColor(); void setClipEnabled(boolean clipEnabled); boolean isClipEnabled(); @Override void draw(@NonNull Canvas canvas); @Override int getOpacity(); @Override void setAlpha(int alpha); @Override int getAlpha(); @Override void setColorFilter(ColorFilter cf); void setRadius(int radius); int getRadius(); }
RoundedDrawable extends Drawable { @Override public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException { super.inflate(r, parser, attrs, theme); TypedArray a = r.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.RoundedDrawable); if (a.hasValue(R.styleable.RoundedDrawable_android_src)) { setDrawable(a.getDrawable(R.styleable.RoundedDrawable_android_src)); } setRadius(a.getDimensionPixelSize(R.styleable.RoundedDrawable_radius, 0)); setClipEnabled(a.getBoolean(R.styleable.RoundedDrawable_clipEnabled, false)); setBackgroundColor( a.getColor(R.styleable.RoundedDrawable_backgroundColor, Color.TRANSPARENT)); a.recycle(); } RoundedDrawable(); @Override void inflate(@NonNull Resources r, @NonNull XmlPullParser parser,
            @NonNull AttributeSet attrs, @Nullable Resources.Theme theme); void setDrawable(@Nullable Drawable drawable); @Nullable Drawable getDrawable(); void setBackgroundColor(@ColorInt int color); @ColorInt int getBackgroundColor(); void setClipEnabled(boolean clipEnabled); boolean isClipEnabled(); @Override void draw(@NonNull Canvas canvas); @Override int getOpacity(); @Override void setAlpha(int alpha); @Override int getAlpha(); @Override void setColorFilter(ColorFilter cf); void setRadius(int radius); int getRadius();  }