Remove fullscreen cover art mode
This commit is contained in:
parent
4a91d0ac9e
commit
623a1b2332
@ -197,7 +197,6 @@ THE SOFTWARE.
|
||||
<string name="info_on_cover">Info on cover art</string>
|
||||
<string name="info_below_cover">Info below cover art</string>
|
||||
<string name="fixed_info">Info fixed at top</string>
|
||||
<string name="fixed_info_fullscreen">Info fixed at top (fullscreen cover art)</string>
|
||||
|
||||
<string name="do_nothing">Do nothing</string>
|
||||
<string name="open_library">Open library</string>
|
||||
|
@ -111,6 +111,5 @@ THE SOFTWARE.
|
||||
<item>@string/info_on_cover</item>
|
||||
<item>@string/info_below_cover</item>
|
||||
<item>@string/fixed_info</item>
|
||||
<item>@string/fixed_info_fullscreen</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user