From 623a1b233202586c6840552f2740972e7ee159a0 Mon Sep 17 00:00:00 2001 From: Christopher Eby Date: Mon, 13 Feb 2012 21:37:31 -0600 Subject: [PATCH] Remove fullscreen cover art mode --- res/values/translatable.xml | 1 - res/values/untranslatable.xml | 1 - src/org/kreed/vanilla/CoverBitmap.java | 49 ------------------- src/org/kreed/vanilla/CoverView.java | 2 +- .../kreed/vanilla/FullPlaybackActivity.java | 15 ++---- 5 files changed, 6 insertions(+), 62 deletions(-) diff --git a/res/values/translatable.xml b/res/values/translatable.xml index 371386db..f8f7119b 100644 --- a/res/values/translatable.xml +++ b/res/values/translatable.xml @@ -197,7 +197,6 @@ THE SOFTWARE. Info on cover art Info below cover art Info fixed at top - Info fixed at top (fullscreen cover art) Do nothing Open library diff --git a/res/values/untranslatable.xml b/res/values/untranslatable.xml index b58b2b56..007997b0 100644 --- a/res/values/untranslatable.xml +++ b/res/values/untranslatable.xml @@ -111,6 +111,5 @@ THE SOFTWARE. @string/info_on_cover @string/info_below_cover @string/fixed_info - @string/fixed_info_fullscreen diff --git a/src/org/kreed/vanilla/CoverBitmap.java b/src/org/kreed/vanilla/CoverBitmap.java index 2e5daa0f..4bd6330a 100644 --- a/src/org/kreed/vanilla/CoverBitmap.java +++ b/src/org/kreed/vanilla/CoverBitmap.java @@ -54,11 +54,6 @@ public final class CoverBitmap { * Draw no song info, only the cover. */ public static final int STYLE_NO_INFO = 2; - /** - * Draw no song info and zoom the cover so that it fills the entire bitmap - * (preserving aspect ratio---some parts of the cover may be cut off). - */ - public static final int STYLE_NO_INFO_ZOOMED = 3; private static int TEXT_SIZE = -1; private static int TEXT_SIZE_BIG; @@ -141,8 +136,6 @@ public final class CoverBitmap { return createSeparatedBitmap(context, coverArt, song, width, height, reuse); case STYLE_NO_INFO: return createScaledBitmap(coverArt, width, height, reuse); - case STYLE_NO_INFO_ZOOMED: - return createZoomedBitmap(coverArt, width, height, reuse); default: throw new IllegalArgumentException("Invalid bitmap type given: " + style); } @@ -336,48 +329,6 @@ public final class CoverBitmap { return bitmap; } - /** - * Scales a bitmap to completely fill a rectangle of the given size. Aspect - * ratio is preserved, thus, parts of the image will be cut off if the - * aspect ratio of the rectangle does not match that of the source bitmap. - * - * @param source The source bitmap. Will be recycled. - * @param width Width of the result - * @param height Height of the result - * @param reuse A bitmap to store the result in if possible - * @return The zoomed bitmap. - */ - private static Bitmap createZoomedBitmap(Bitmap source, int width, int height, Bitmap reuse) - { - Bitmap bitmap = null; - - if (reuse != null) { - if (reuse.getHeight() == height && reuse.getWidth() == width) - bitmap = reuse; - else - reuse.recycle(); - } - - if (bitmap == null) - bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); - Canvas canvas = new Canvas(bitmap); - - int sourceWidth = source.getWidth(); - int sourceHeight = source.getHeight(); - int size = Math.max(width, height); - float scale = sourceWidth < sourceHeight ? (float)size / sourceWidth : (float)size / sourceHeight; - - int srcWidth = (int)(Math.min(width, sourceWidth * scale) / scale); - int srcHeight = (int)(Math.min(height, sourceHeight * scale) / scale); - int xOffset = (sourceWidth - srcWidth) / 2; - int yOffset = (sourceHeight - srcHeight) / 2; - Rect src = new Rect(xOffset, yOffset, sourceWidth - xOffset, sourceHeight - yOffset); - Rect dest = new Rect(0, 0, width, height); - canvas.drawBitmap(source, src, dest, null); - - return bitmap; - } - /** * Scales a bitmap to fit in a rectangle of the given size. Aspect ratio is * preserved. At least one dimension of the result will match the provided diff --git a/src/org/kreed/vanilla/CoverView.java b/src/org/kreed/vanilla/CoverView.java index 0da4f837..33ead718 100644 --- a/src/org/kreed/vanilla/CoverView.java +++ b/src/org/kreed/vanilla/CoverView.java @@ -353,7 +353,7 @@ public final class CoverView extends View implements Handler.Callback { int height = getHeight(); Bitmap bitmap; - if (cover == null && (style == CoverBitmap.STYLE_NO_INFO || style == CoverBitmap.STYLE_NO_INFO_ZOOMED)) { + if (cover == null && style == CoverBitmap.STYLE_NO_INFO) { if (mDefaultCover == null) mDefaultCover = CoverBitmap.generateDefaultCover(width, height); bitmap = mDefaultCover; diff --git a/src/org/kreed/vanilla/FullPlaybackActivity.java b/src/org/kreed/vanilla/FullPlaybackActivity.java index f1ab9af9..2eea7ecb 100644 --- a/src/org/kreed/vanilla/FullPlaybackActivity.java +++ b/src/org/kreed/vanilla/FullPlaybackActivity.java @@ -51,7 +51,6 @@ public class FullPlaybackActivity extends PlaybackActivity public static final int DISPLAY_INFO_OVERLAP = 0; public static final int DISPLAY_INFO_BELOW = 1; public static final int DISPLAY_INFO_WIDGETS = 2; - public static final int DISPLAY_INFO_WIDGETS_ZOOMED = 3; private TextView mOverlayText; private View mControlsBottom; @@ -107,22 +106,18 @@ public class FullPlaybackActivity extends PlaybackActivity switch (displayMode) { default: - Log.w("VanillaMusic", "Invalid display mode given. Defaulting to overlap."); + Log.w("VanillaMusic", "Invalid display mode given. Defaulting to widget mode."); // fall through + case DISPLAY_INFO_WIDGETS: + coverStyle = CoverBitmap.STYLE_NO_INFO; + layout = R.layout.full_playback_alt; + break; case DISPLAY_INFO_OVERLAP: coverStyle = CoverBitmap.STYLE_OVERLAPPING_BOX; break; case DISPLAY_INFO_BELOW: coverStyle = CoverBitmap.STYLE_INFO_BELOW; break; - case DISPLAY_INFO_WIDGETS: - coverStyle = CoverBitmap.STYLE_NO_INFO; - layout = R.layout.full_playback_alt; - break; - case DISPLAY_INFO_WIDGETS_ZOOMED: - coverStyle = CoverBitmap.STYLE_NO_INFO_ZOOMED; - layout = R.layout.full_playback_alt; - break; } setContentView(layout);