@Test public void getOpacity() { badgeDrawable.setAlpha(0); assertThat(badgeDrawable.getOpacity(), is(PixelFormat.TRANSPARENT)); badgeDrawable.setAlpha(1); assertThat(badgeDrawable.getOpacity(), is(PixelFormat.TRANSLUCENT)); badgeDrawable.setAlpha(255); assertThat(badgeDrawable.getOpacity(), is(PixelFormat.OPAQUE)); }
@Override public int getOpacity() { if (alpha == 255) { return PixelFormat.OPAQUE; } if (alpha == 0) { return PixelFormat.TRANSPARENT; } return PixelFormat.TRANSLUCENT; }
BadgeDrawable extends Drawable { @Override public int getOpacity() { if (alpha == 255) { return PixelFormat.OPAQUE; } if (alpha == 0) { return PixelFormat.TRANSPARENT; } return PixelFormat.TRANSLUCENT; } }
BadgeDrawable extends Drawable { @Override public int getOpacity() { if (alpha == 255) { return PixelFormat.OPAQUE; } if (alpha == 0) { return PixelFormat.TRANSPARENT; } return PixelFormat.TRANSLUCENT; }  }
BadgeDrawable extends Drawable { @Override public int getOpacity() { if (alpha == 255) { return PixelFormat.OPAQUE; } if (alpha == 0) { return PixelFormat.TRANSPARENT; } return PixelFormat.TRANSLUCENT; }  @Override void setAlpha(@IntRange(from = 0, to = 255) int alpha); @Override int getAlpha(); @Override void setColorFilter(@Nullable ColorFilter colorFilter); @Override @Nullable ColorFilter getColorFilter(); @Override int getOpacity(); @Nullable @Override ConstantState getConstantState(); }
BadgeDrawable extends Drawable { @Override public int getOpacity() { if (alpha == 255) { return PixelFormat.OPAQUE; } if (alpha == 0) { return PixelFormat.TRANSPARENT; } return PixelFormat.TRANSLUCENT; }  @Override void setAlpha(@IntRange(from = 0, to = 255) int alpha); @Override int getAlpha(); @Override void setColorFilter(@Nullable ColorFilter colorFilter); @Override @Nullable ColorFilter getColorFilter(); @Override int getOpacity(); @Nullable @Override ConstantState getConstantState();  }