@Test public void testIsRounded(){ BorderDrawable none = new BorderDrawable(); assertThat(none.isRounded(), is(false)); BorderDrawable full = new BorderDrawable(); full.setBorderRadius(Spacing.ALL, 12); assertThat(full.isRounded(), is(true)); BorderDrawable noneAndPart = new BorderDrawable(); noneAndPart.setBorderRadius(BorderDrawable.BORDER_TOP_LEFT_RADIUS, 5); noneAndPart.setBorderRadius(BorderDrawable.BORDER_BOTTOM_RIGHT_RADIUS, 12); assertThat(noneAndPart.isRounded(), is(true)); BorderDrawable fullAndPart = new BorderDrawable(); fullAndPart.setBorderRadius(BorderDrawable.BORDER_RADIUS_ALL, 0); fullAndPart.setBorderRadius(BorderDrawable.BORDER_TOP_LEFT_RADIUS, 12); fullAndPart.setBorderRadius(BorderDrawable.BORDER_BOTTOM_RIGHT_RADIUS, 19); assertThat(fullAndPart.isRounded(), is(true)); BorderDrawable partAndFull = new BorderDrawable(); partAndFull.setBorderRadius(BorderDrawable.BORDER_TOP_LEFT_RADIUS, 12); partAndFull.setBorderRadius(BorderDrawable.BORDER_RADIUS_ALL, 0); assertThat(partAndFull.isRounded(), is(true)); BorderDrawable zeroAll = new BorderDrawable(); zeroAll.setBorderRadius(BorderDrawable.BORDER_RADIUS_ALL, 0); assertThat(zeroAll.isRounded(), is(false)); BorderDrawable zeroPart = new BorderDrawable(); zeroPart.setBorderRadius(BorderDrawable.BORDER_TOP_LEFT_RADIUS, 0); assertThat(zeroPart.isRounded(), is(false)); }
public boolean isRounded() { return mBorderRadius != null && (!FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_LEFT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_LEFT_RADIUS), 0)); }
BorderDrawable extends Drawable { public boolean isRounded() { return mBorderRadius != null && (!FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_LEFT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_LEFT_RADIUS), 0)); } }
BorderDrawable extends Drawable { public boolean isRounded() { return mBorderRadius != null && (!FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_LEFT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_LEFT_RADIUS), 0)); } BorderDrawable(); }
BorderDrawable extends Drawable { public boolean isRounded() { return mBorderRadius != null && (!FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_LEFT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_LEFT_RADIUS), 0)); } BorderDrawable(); @Override void draw(@NonNull Canvas canvas); @Override void setAlpha(int alpha); @Override int getAlpha(); @Override void setColorFilter(ColorFilter cf); @SuppressWarnings("WrongConstant") @Override int getOpacity(); @Override void getOutline(@NonNull Outline outline); void setBorderWidth(int position, float width); void setBorderRadius(int position, float radius); @NonNull float[] getBorderRadius(RectF borderBox); void setBorderColor(int position, int color); void setBorderStyle(int position, @NonNull String style); int getColor(); void setColor(int color); void setImage(Shader shader); boolean isRounded(); @NonNull Path getContentPath(@NonNull RectF borderBox); }
BorderDrawable extends Drawable { public boolean isRounded() { return mBorderRadius != null && (!FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_LEFT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_TOP_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_RIGHT_RADIUS), 0) || !FloatUtil.floatsEqual(getBorderRadius(mBorderRadius, BORDER_BOTTOM_LEFT_RADIUS), 0)); } BorderDrawable(); @Override void draw(@NonNull Canvas canvas); @Override void setAlpha(int alpha); @Override int getAlpha(); @Override void setColorFilter(ColorFilter cf); @SuppressWarnings("WrongConstant") @Override int getOpacity(); @Override void getOutline(@NonNull Outline outline); void setBorderWidth(int position, float width); void setBorderRadius(int position, float radius); @NonNull float[] getBorderRadius(RectF borderBox); void setBorderColor(int position, int color); void setBorderStyle(int position, @NonNull String style); int getColor(); void setColor(int color); void setImage(Shader shader); boolean isRounded(); @NonNull Path getContentPath(@NonNull RectF borderBox); static final int BORDER_TOP_LEFT_RADIUS; static final int BORDER_TOP_RIGHT_RADIUS; static final int BORDER_BOTTOM_RIGHT_RADIUS; static final int BORDER_BOTTOM_LEFT_RADIUS; static final int BORDER_RADIUS_ALL; }