generate fallback cover for any style excluding OVERLAPPING_BOX

This commit is contained in:
Adrian Ulrich 2015-08-19 19:04:03 +02:00
parent d6fa617b0e
commit 06f98f1c55
2 changed files with 7 additions and 9 deletions

View File

@ -181,7 +181,7 @@ public final class CoverBitmap {
int bitmapWidth = Math.max(coverWidth, boxWidth);
int bitmapHeight = Math.max(coverHeight, boxHeight);
Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.RGB_565);
Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
if (cover != null) {
@ -267,7 +267,7 @@ public final class CoverBitmap {
int bitmapWidth = horizontal ? coverWidth + boxWidth : Math.max(coverWidth, boxWidth);
int bitmapHeight = horizontal ? Math.max(coverHeight, boxHeight) : coverHeight + boxHeight;
Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.RGB_565);
Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
if (cover != null) {

View File

@ -365,16 +365,14 @@ public final class CoverView extends View implements Handler.Callback {
Context context = getContext();
Bitmap cover = song == null ? null : song.getCover(context);
if (cover == null && style == CoverBitmap.STYLE_NO_INFO) {
Bitmap def = mDefaultCover;
if (def == null) {
mDefaultCover = def = CoverBitmap.generateDefaultCover(context, getWidth(), getHeight());
if (cover == null && style != CoverBitmap.STYLE_OVERLAPPING_BOX) {
if (mDefaultCover == null) {
mDefaultCover = CoverBitmap.generateDefaultCover(context, getWidth(), getHeight());
}
mBitmaps[i] = def;
} else {
mBitmaps[i] = CoverBitmap.createBitmap(context, style, cover, song, getWidth(), getHeight());
cover = mDefaultCover;
}
mBitmaps[i] = CoverBitmap.createBitmap(context, style, cover, song, getWidth(), getHeight());
postInvalidate();
}