@Override
protected void onDraw(Canvas canvas) {
int pic=SkinMan.currentSkin.actionPicture();
Drawable backgroundDrawable = pic!=0 ? ContextCompat.getDrawable(getContext(), pic) : ApplicationLoader.getCachedWallpaper();
int color = ApplicationLoader.getServiceMessageColor();
if (currentColor != color) {
currentColor = color;
shadowView.getDrawable().setColorFilter(new PorterDuffColorFilter(color | 0xff000000, PorterDuff.Mode.MULTIPLY));
}
if (ApplicationLoader.isCustomTheme() || pic !=0 && backgroundDrawable != null) {
phoneTextView.setTextColor(0xffffffff);
shadowView.setVisibility(VISIBLE);
if (backgroundDrawable instanceof ColorDrawable) {
backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
backgroundDrawable.draw(canvas);
} else if (backgroundDrawable instanceof BitmapDrawable) {
Bitmap bitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
float scaleX = (float) getMeasuredWidth() / (float) bitmap.getWidth();
float scaleY = (float) getMeasuredHeight() / (float) bitmap.getHeight();
float scale = scaleX < scaleY ? scaleY : scaleX;
int width = (int) (getMeasuredWidth() / scale);
int height = (int) (getMeasuredHeight() / scale);
int x = (bitmap.getWidth() - width) / 2;
int y = (bitmap.getHeight() - height) / 2;
srcRect.set(x, y, x + width, y + height);
destRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
canvas.drawBitmap(bitmap, srcRect, destRect, paint);
}
} else {
shadowView.setVisibility(INVISIBLE);
phoneTextView.setTextColor(0xffc2e5ff);
super.onDraw(canvas);
}
}
DrawerProfileCell.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:airgram
作者:
评论列表
文章目录