diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/CoverBitmap.java b/app/src/main/java/ch/blinkenlights/android/vanilla/CoverBitmap.java index 18f221d3..25896974 100644 --- a/app/src/main/java/ch/blinkenlights/android/vanilla/CoverBitmap.java +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/CoverBitmap.java @@ -61,9 +61,6 @@ public final class CoverBitmap { private static int TEXT_SIZE_BIG; private static int PADDING; private static int BOTTOM_PADDING; - private static Bitmap SONG_ICON; - private static Bitmap ALBUM_ICON; - private static Bitmap ARTIST_ICON; /** * Initialize the regular text size members. @@ -76,20 +73,7 @@ public final class CoverBitmap { TEXT_SIZE = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, metrics); TEXT_SIZE_BIG = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, metrics); PADDING = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, metrics); - BOTTOM_PADDING = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 136, metrics); - } - - /** - * Initialize the icon bitmaps. - * - * @param context A context to use. - */ - private static void loadIcons(Context context) - { - Resources res = context.getResources(); - SONG_ICON = BitmapFactory.decodeResource(res, R.drawable.ic_musicnote); - ALBUM_ICON = BitmapFactory.decodeResource(res, R.drawable.ic_disk); - ARTIST_ICON = BitmapFactory.decodeResource(res, R.drawable.ic_microphone); + BOTTOM_PADDING = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 160, metrics); } /** @@ -224,8 +208,6 @@ public final class CoverBitmap { { if (TEXT_SIZE == -1) loadTextSizes(context); - if (SONG_ICON == null) - loadIcons(context); int textSize = TEXT_SIZE; int textSizeBig = TEXT_SIZE_BIG; @@ -233,15 +215,9 @@ public final class CoverBitmap { // Get desired text color from theme and draw textual information int colors[] = ThemeHelper.getDefaultCoverColors(context); + // inverted cover background color. int textColor = 0xFF000000 + (0xFFFFFF - (colors[0] & 0xFFFFFF)); - PorterDuffColorFilter filter = new PorterDuffColorFilter(textColor, PorterDuff.Mode.SRC_ATOP); - - Paint paint = new Paint(); - paint.setAntiAlias(true); - paint.setColorFilter(filter); - paint.setTextSize(textSize); - String title = song.title == null ? "" : song.title; String album = song.album == null ? "" : song.album; String artist = song.artist == null ? "" : song.artist; @@ -249,7 +225,6 @@ public final class CoverBitmap { Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); - int left = padding; int top = height - BOTTOM_PADDING; // top describes where the text will start, so we can draw the cover on 0 -> top @@ -276,17 +251,27 @@ public final class CoverBitmap { } - // Draw all texts - canvas.drawBitmap(SONG_ICON, left, top, paint); - drawText(canvas, title, left + padding + textSize, top, width, width, paint); - top += textSize + padding; + PorterDuffColorFilter filter = new PorterDuffColorFilter(textColor, PorterDuff.Mode.SRC_ATOP); + Paint paint = new Paint(); + paint.setAntiAlias(true); - canvas.drawBitmap(ALBUM_ICON, left, top, paint); - drawText(canvas, album, left + padding + textSize, top, width, width, paint); - top += textSize + padding; + // Title text + paint.setColorFilter(filter); + paint.setTextSize(textSizeBig); - canvas.drawBitmap(ARTIST_ICON, left, top, paint); - drawText(canvas, artist, left + padding + textSize, top, width, width, paint); + int twidth = (int)paint.measureText(title); + int tstart = (width - twidth)/2; + drawText(canvas, title, tstart, top, width, twidth, paint); + top += textSizeBig + padding; + + // Bottom text + paint.setAlpha(0xAA); + paint.setTextSize(textSize); + + String artistAlbum = artist + " — " + album; + twidth = (int)paint.measureText(artistAlbum); + tstart = (width - twidth)/2; + drawText(canvas, artistAlbum, tstart, top, width, twidth, paint); return bitmap; } diff --git a/app/src/main/res/drawable-hdpi/ic_disk.png b/app/src/main/res/drawable-hdpi/ic_disk.png deleted file mode 100644 index 049d32cc..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_disk.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_microphone.png b/app/src/main/res/drawable-hdpi/ic_microphone.png deleted file mode 100644 index d041b0a8..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_microphone.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_musicnote.png b/app/src/main/res/drawable-hdpi/ic_musicnote.png deleted file mode 100644 index 6a5fe174..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_musicnote.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_disk.png b/app/src/main/res/drawable-mdpi/ic_disk.png deleted file mode 100644 index 471348f8..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_disk.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_microphone.png b/app/src/main/res/drawable-mdpi/ic_microphone.png deleted file mode 100644 index cf06ddb5..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_microphone.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_musicnote.png b/app/src/main/res/drawable-mdpi/ic_musicnote.png deleted file mode 100644 index 6512551b..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_musicnote.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_disk.png b/app/src/main/res/drawable-xhdpi/ic_disk.png deleted file mode 100644 index 0e6342ea..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_disk.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_microphone.png b/app/src/main/res/drawable-xhdpi/ic_microphone.png deleted file mode 100644 index c3389aa3..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_microphone.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_musicnote.png b/app/src/main/res/drawable-xhdpi/ic_musicnote.png deleted file mode 100644 index ffac69a0..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_musicnote.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_disk.png b/app/src/main/res/drawable-xxhdpi/ic_disk.png deleted file mode 100644 index 2dc4d9f0..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_disk.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_microphone.png b/app/src/main/res/drawable-xxhdpi/ic_microphone.png deleted file mode 100644 index 65fbf016..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_microphone.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_musicnote.png b/app/src/main/res/drawable-xxhdpi/ic_musicnote.png deleted file mode 100644 index 2532cea0..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_musicnote.png and /dev/null differ diff --git a/orig/drawable/ic_disk.svgz b/orig/drawable/ic_disk.svgz deleted file mode 100644 index 9420ef3d..00000000 Binary files a/orig/drawable/ic_disk.svgz and /dev/null differ diff --git a/orig/drawable/ic_microphone.svgz b/orig/drawable/ic_microphone.svgz deleted file mode 100644 index e2331dff..00000000 Binary files a/orig/drawable/ic_microphone.svgz and /dev/null differ diff --git a/orig/drawable/ic_musicnote.svgz b/orig/drawable/ic_musicnote.svgz deleted file mode 100644 index 367a144f..00000000 Binary files a/orig/drawable/ic_musicnote.svgz and /dev/null differ