public class Cat extends Drawable
Modifier and Type | Class and Description |
---|---|
static class |
Cat.CatParts |
Drawable.Callback, Drawable.ConstantState
Modifier and Type | Field and Description |
---|---|
static int[] |
P_BELLY_COLORS |
static int[] |
P_BODY_COLORS |
static int[] |
P_COLLAR_COLORS |
static int[] |
P_DARK_SPOT_COLORS |
static int[] |
P_LIGHT_SPOT_COLORS |
static long[] |
PURR |
Modifier and Type | Method and Description |
---|---|
Notification.Builder |
buildNotification(Context context) |
static Object |
choose(Random r,
Object... l) |
static int |
chooseP(Random r,
int[] a) |
static Cat |
create(Context context) |
Bitmap |
createBitmap(int w,
int h) |
Icon |
createIcon(Context context,
int w,
int h) |
Icon |
createNotificationLargeIcon(Context context) |
void |
draw(Canvas canvas)
Draw in its bounds (set via setBounds) respecting optional effects such
as alpha (set via setAlpha) and color filter (set via setColorFilter).
|
static float |
frandrange(Random r,
float a,
float b) |
int |
getBodyColor() |
static int |
getColorIndex(int q,
int[] a) |
String |
getName() |
int |
getOpacity()
Return the opacity/transparency of this Drawable.
|
long |
getSeed() |
static boolean |
isDark(int color) |
void |
logAdd(Context context) |
void |
logRemove(Context context) |
void |
logRename(Context context) |
void |
logShare(Context context) |
static Icon |
recompressIcon(Icon bitmapIcon) |
void |
setAlpha(int i)
Specify an alpha value for the drawable. 0 means fully transparent, and
255 means fully opaque.
|
void |
setColorFilter(ColorFilter colorFilter)
Specify an optional color filter for the drawable.
|
void |
setName(String name) |
static void |
tint(int color,
Drawable... ds) |
applyTheme, canApplyTheme, clearColorFilter, clearMutated, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getAlpha, getBounds, getCallback, getChangingConfigurations, getColorFilter, getConstantState, getCurrent, getDirtyBounds, getHotspotBounds, getIntrinsicHeight, getIntrinsicWidth, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOpticalInsets, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isProjected, isStateful, isVisible, jumpToCurrentState, mutate, obtainAttributes, onBoundsChange, onLayoutDirectionChanged, onLevelChange, onStateChange, parseTintMode, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintList, setTintMode, setVisible, setXfermode, unscheduleSelf
public static final long[] PURR
public static final int[] P_BODY_COLORS
public static final int[] P_COLLAR_COLORS
public static final int[] P_BELLY_COLORS
public static final int[] P_DARK_SPOT_COLORS
public static final int[] P_LIGHT_SPOT_COLORS
public Cat(Context context, long seed)
public static final float frandrange(Random r, float a, float b)
public static final int chooseP(Random r, int[] a)
public static final int getColorIndex(int q, int[] a)
public static void tint(int color, Drawable... ds)
public static boolean isDark(int color)
public Notification.Builder buildNotification(Context context)
public long getSeed()
public void draw(Canvas canvas)
Drawable
public Bitmap createBitmap(int w, int h)
public void setAlpha(int i)
Drawable
public void setColorFilter(ColorFilter colorFilter)
Drawable
If a Drawable has a ColorFilter, each output pixel of the Drawable's drawing contents will be modified by the color filter before it is blended onto the render target of a Canvas.
Pass null
to remove any existing color filter.
Note: Setting a non-null
color
filter disables tint
.
setColorFilter
in class Drawable
colorFilter
- The color filter to apply, or null
to remove the
existing color filterpublic int getOpacity()
Drawable
PixelFormat
:
PixelFormat.UNKNOWN
,
PixelFormat.TRANSLUCENT
,
PixelFormat.TRANSPARENT
, or
PixelFormat.OPAQUE
.
An OPAQUE drawable is one that draws all all content within its bounds, completely covering anything behind the drawable. A TRANSPARENT drawable is one that draws nothing within its bounds, allowing everything behind it to show through. A TRANSLUCENT drawable is a drawable in any other state, where the drawable will draw some, but not all, of the content within its bounds and at least some content behind the drawable will be visible. If the visibility of the drawable's contents cannot be determined, the safest/best return value is TRANSLUCENT.
Generally a Drawable should be as conservative as possible with the
value it returns. For example, if it contains multiple child drawables
and only shows one of them at a time, if only one of the children is
TRANSLUCENT and the others are OPAQUE then TRANSLUCENT should be
returned. You can use the method Drawable.resolveOpacity(int, int)
to perform a
standard reduction of two opacities to the appropriate single output.
Note that the returned value does not necessarily take into account a
custom alpha or color filter that has been applied by the client through
the Drawable.setAlpha(int)
or Drawable.setColorFilter(android.graphics.ColorFilter)
methods. Some subclasses,
such as BitmapDrawable
, ColorDrawable
, and GradientDrawable
,
do account for the value of Drawable.setAlpha(int)
, but the general behavior is dependent
upon the implementation of the subclass.
getOpacity
in class Drawable
PixelFormat
public String getName()
public void setName(String name)
public int getBodyColor()
public void logAdd(Context context)
public void logRename(Context context)
public void logRemove(Context context)
public void logShare(Context context)