Loading res/values/colors.xml +12 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ <color name="letter_tile_default_color">#cccccc</color> <color name="letter_tile_font_color">#ffffff</color> <array name="letter_tile_colors"> <item>#9237A2</item> <item>#883397</item> <item>#4B498C</item> <item>#4E5BA7</item> <item>#41A4F4</item> Loading @@ -130,4 +130,15 @@ <item>#B9BF45</item> <item>#757578</item> </array> <array name="letter_tile_vibrant_dark_colors"> <item>#b74bc9</item> <item>#6967bf</item> <item>#2a315a</item> <item>#07497d</item> <item>#0c6c64</item> <item>#415a2a</item> <item>#5f6322</item> <item>#505052</item> </array> </resources> src/com/cyanogenmod/eleven/MusicPlaybackService.java +14 −33 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.database.MatrixCursor; import android.graphics.Bitmap; import android.media.AudioManager; import android.media.AudioManager.OnAudioFocusChangeListener; import android.media.MediaMetadataRetriever; import android.media.MediaMetadata; import android.media.MediaPlayer; import android.media.audiofx.AudioEffect; Loading @@ -52,7 +51,6 @@ import android.os.SystemClock; import android.provider.MediaStore; import android.provider.MediaStore.Audio.AlbumColumns; import android.provider.MediaStore.Audio.AudioColumns; import android.support.v7.graphics.Palette; import android.text.TextUtils; import android.util.Log; Loading @@ -66,7 +64,7 @@ import com.cyanogenmod.eleven.provider.MusicPlaybackState; import com.cyanogenmod.eleven.provider.RecentStore; import com.cyanogenmod.eleven.provider.SongPlayCount; import com.cyanogenmod.eleven.service.MusicPlaybackTrack; import com.cyanogenmod.eleven.utils.ApolloUtils; import com.cyanogenmod.eleven.utils.BitmapWithColors; import com.cyanogenmod.eleven.utils.Lists; import com.cyanogenmod.eleven.utils.SrtManager; Loading Loading @@ -496,8 +494,7 @@ public class MusicPlaybackService extends Service { // to improve perf, instead of hitting the disk cache or file cache, store the bitmaps in memory private String mCachedKey; private Bitmap[] mCachedBitmap = new Bitmap[2]; private int mCachedBitmapAccentColor = 0; private BitmapWithColors[] mCachedBitmapWithColors = new BitmapWithColors[2]; /** * Image cache Loading Loading @@ -1475,7 +1472,7 @@ public class MusicPlaybackService extends Service { mSession.setPlaybackState(new PlaybackState.Builder() .setState(playState, position(), 1.0f).build()); } else if (what.equals(META_CHANGED) || what.equals(QUEUE_CHANGED)) { Bitmap albumArt = getAlbumArt(false); Bitmap albumArt = getAlbumArt(false).getBitmap(); if (albumArt != null) { // RemoteControlClient wants to recycle the bitmaps thrown at it, so we need // to make sure not to hand out our cache copy Loading Loading @@ -1522,7 +1519,7 @@ public class MusicPlaybackService extends Service { Intent nowPlayingIntent = new Intent("com.cyanogenmod.eleven.AUDIO_PLAYER") .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent clickIntent = PendingIntent.getActivity(this, 0, nowPlayingIntent, 0); Bitmap artwork = getAlbumArt(false); BitmapWithColors artwork = getAlbumArt(false); if (mNotificationPostTime == 0) { mNotificationPostTime = System.currentTimeMillis(); Loading @@ -1530,7 +1527,7 @@ public class MusicPlaybackService extends Service { Notification.Builder builder = new Notification.Builder(this) .setSmallIcon(R.drawable.ic_notification) .setLargeIcon(artwork) .setLargeIcon(artwork.getBitmap()) .setContentIntent(clickIntent) .setContentTitle(getTrackName()) .setContentText(text) Loading @@ -1547,23 +1544,7 @@ public class MusicPlaybackService extends Service { getString(R.string.accessibility_next), retrievePlaybackAction(NEXT_ACTION)); if (mCachedBitmapAccentColor == 0 && artwork != null) { // Generate a new Palette from the current artwork final Palette p = Palette.generate(artwork); if (p != null) { // Check for dark vibrant colors, then vibrant Palette.Swatch swatch = p.getDarkVibrantSwatch(); if (swatch == null) { swatch = p.getVibrantSwatch(); } if (swatch != null) { mCachedBitmapAccentColor = swatch.getRgb(); } } } if (mCachedBitmapAccentColor != 0) { builder.setColor(mCachedBitmapAccentColor); } builder.setColor(artwork.getVibrantDarkColor()); return builder.build(); } Loading Loading @@ -2680,7 +2661,7 @@ public class MusicPlaybackService extends Service { * Currently Has no impact on the artwork size if one exists * @return The album art for the current album. */ public Bitmap getAlbumArt(boolean smallBitmap) { public BitmapWithColors getAlbumArt(boolean smallBitmap) { final String albumName = getAlbumName(); final String artistName = getArtistName(); final long albumId = getAlbumId(); Loading @@ -2688,23 +2669,23 @@ public class MusicPlaybackService extends Service { final int targetIndex = smallBitmap ? 0 : 1; // if the cached key matches and we have the bitmap, return it if (key.equals(mCachedKey) && mCachedBitmap[targetIndex] != null) { return mCachedBitmap[targetIndex]; if (key.equals(mCachedKey) && mCachedBitmapWithColors[targetIndex] != null) { return mCachedBitmapWithColors[targetIndex]; } // otherwise get the artwork (or defaultartwork if none found) final Bitmap bitmap = mImageFetcher.getArtwork(albumName, albumId, artistName, smallBitmap); final BitmapWithColors bitmap = mImageFetcher.getArtwork(albumName, albumId, artistName, smallBitmap); // if the key is different, clear the bitmaps first if (!key.equals(mCachedKey)) { mCachedBitmap[0] = null; mCachedBitmap[1] = null; mCachedBitmapAccentColor = 0; mCachedBitmapWithColors[0] = null; mCachedBitmapWithColors[1] = null; } // store the new key and bitmap mCachedKey = key; mCachedBitmap[targetIndex] = bitmap; mCachedBitmapWithColors[targetIndex] = bitmap; return bitmap; } Loading src/com/cyanogenmod/eleven/appwidgets/AppWidgetLarge.java +1 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ public class AppWidgetLarge extends AppWidgetBase { final CharSequence trackName = service.getTrackName(); final CharSequence artistName = service.getArtistName(); final CharSequence albumName = service.getAlbumName(); final Bitmap bitmap = service.getAlbumArt(true); final Bitmap bitmap = service.getAlbumArt(true).getBitmap(); // Set the titles and artwork appWidgetView.setTextViewText(R.id.app_widget_large_line_one, trackName); Loading src/com/cyanogenmod/eleven/appwidgets/AppWidgetLargeAlternate.java +1 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class AppWidgetLargeAlternate extends AppWidgetBase { final CharSequence trackName = service.getTrackName(); final CharSequence artistName = service.getArtistName(); final CharSequence albumName = service.getAlbumName(); final Bitmap bitmap = service.getAlbumArt(true); final Bitmap bitmap = service.getAlbumArt(true).getBitmap(); // Set the titles and artwork appWidgetView.setTextViewText(R.id.app_widget_large_alternate_line_one, trackName); Loading src/com/cyanogenmod/eleven/appwidgets/AppWidgetSmall.java +1 −1 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ public class AppWidgetSmall extends AppWidgetBase { final CharSequence trackName = service.getTrackName(); final CharSequence artistName = service.getArtistName(); final Bitmap bitmap = service.getAlbumArt(true); final Bitmap bitmap = service.getAlbumArt(true).getBitmap(); // Set the titles and artwork if (TextUtils.isEmpty(trackName) && TextUtils.isEmpty(artistName)) { Loading Loading
res/values/colors.xml +12 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ <color name="letter_tile_default_color">#cccccc</color> <color name="letter_tile_font_color">#ffffff</color> <array name="letter_tile_colors"> <item>#9237A2</item> <item>#883397</item> <item>#4B498C</item> <item>#4E5BA7</item> <item>#41A4F4</item> Loading @@ -130,4 +130,15 @@ <item>#B9BF45</item> <item>#757578</item> </array> <array name="letter_tile_vibrant_dark_colors"> <item>#b74bc9</item> <item>#6967bf</item> <item>#2a315a</item> <item>#07497d</item> <item>#0c6c64</item> <item>#415a2a</item> <item>#5f6322</item> <item>#505052</item> </array> </resources>
src/com/cyanogenmod/eleven/MusicPlaybackService.java +14 −33 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.database.MatrixCursor; import android.graphics.Bitmap; import android.media.AudioManager; import android.media.AudioManager.OnAudioFocusChangeListener; import android.media.MediaMetadataRetriever; import android.media.MediaMetadata; import android.media.MediaPlayer; import android.media.audiofx.AudioEffect; Loading @@ -52,7 +51,6 @@ import android.os.SystemClock; import android.provider.MediaStore; import android.provider.MediaStore.Audio.AlbumColumns; import android.provider.MediaStore.Audio.AudioColumns; import android.support.v7.graphics.Palette; import android.text.TextUtils; import android.util.Log; Loading @@ -66,7 +64,7 @@ import com.cyanogenmod.eleven.provider.MusicPlaybackState; import com.cyanogenmod.eleven.provider.RecentStore; import com.cyanogenmod.eleven.provider.SongPlayCount; import com.cyanogenmod.eleven.service.MusicPlaybackTrack; import com.cyanogenmod.eleven.utils.ApolloUtils; import com.cyanogenmod.eleven.utils.BitmapWithColors; import com.cyanogenmod.eleven.utils.Lists; import com.cyanogenmod.eleven.utils.SrtManager; Loading Loading @@ -496,8 +494,7 @@ public class MusicPlaybackService extends Service { // to improve perf, instead of hitting the disk cache or file cache, store the bitmaps in memory private String mCachedKey; private Bitmap[] mCachedBitmap = new Bitmap[2]; private int mCachedBitmapAccentColor = 0; private BitmapWithColors[] mCachedBitmapWithColors = new BitmapWithColors[2]; /** * Image cache Loading Loading @@ -1475,7 +1472,7 @@ public class MusicPlaybackService extends Service { mSession.setPlaybackState(new PlaybackState.Builder() .setState(playState, position(), 1.0f).build()); } else if (what.equals(META_CHANGED) || what.equals(QUEUE_CHANGED)) { Bitmap albumArt = getAlbumArt(false); Bitmap albumArt = getAlbumArt(false).getBitmap(); if (albumArt != null) { // RemoteControlClient wants to recycle the bitmaps thrown at it, so we need // to make sure not to hand out our cache copy Loading Loading @@ -1522,7 +1519,7 @@ public class MusicPlaybackService extends Service { Intent nowPlayingIntent = new Intent("com.cyanogenmod.eleven.AUDIO_PLAYER") .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent clickIntent = PendingIntent.getActivity(this, 0, nowPlayingIntent, 0); Bitmap artwork = getAlbumArt(false); BitmapWithColors artwork = getAlbumArt(false); if (mNotificationPostTime == 0) { mNotificationPostTime = System.currentTimeMillis(); Loading @@ -1530,7 +1527,7 @@ public class MusicPlaybackService extends Service { Notification.Builder builder = new Notification.Builder(this) .setSmallIcon(R.drawable.ic_notification) .setLargeIcon(artwork) .setLargeIcon(artwork.getBitmap()) .setContentIntent(clickIntent) .setContentTitle(getTrackName()) .setContentText(text) Loading @@ -1547,23 +1544,7 @@ public class MusicPlaybackService extends Service { getString(R.string.accessibility_next), retrievePlaybackAction(NEXT_ACTION)); if (mCachedBitmapAccentColor == 0 && artwork != null) { // Generate a new Palette from the current artwork final Palette p = Palette.generate(artwork); if (p != null) { // Check for dark vibrant colors, then vibrant Palette.Swatch swatch = p.getDarkVibrantSwatch(); if (swatch == null) { swatch = p.getVibrantSwatch(); } if (swatch != null) { mCachedBitmapAccentColor = swatch.getRgb(); } } } if (mCachedBitmapAccentColor != 0) { builder.setColor(mCachedBitmapAccentColor); } builder.setColor(artwork.getVibrantDarkColor()); return builder.build(); } Loading Loading @@ -2680,7 +2661,7 @@ public class MusicPlaybackService extends Service { * Currently Has no impact on the artwork size if one exists * @return The album art for the current album. */ public Bitmap getAlbumArt(boolean smallBitmap) { public BitmapWithColors getAlbumArt(boolean smallBitmap) { final String albumName = getAlbumName(); final String artistName = getArtistName(); final long albumId = getAlbumId(); Loading @@ -2688,23 +2669,23 @@ public class MusicPlaybackService extends Service { final int targetIndex = smallBitmap ? 0 : 1; // if the cached key matches and we have the bitmap, return it if (key.equals(mCachedKey) && mCachedBitmap[targetIndex] != null) { return mCachedBitmap[targetIndex]; if (key.equals(mCachedKey) && mCachedBitmapWithColors[targetIndex] != null) { return mCachedBitmapWithColors[targetIndex]; } // otherwise get the artwork (or defaultartwork if none found) final Bitmap bitmap = mImageFetcher.getArtwork(albumName, albumId, artistName, smallBitmap); final BitmapWithColors bitmap = mImageFetcher.getArtwork(albumName, albumId, artistName, smallBitmap); // if the key is different, clear the bitmaps first if (!key.equals(mCachedKey)) { mCachedBitmap[0] = null; mCachedBitmap[1] = null; mCachedBitmapAccentColor = 0; mCachedBitmapWithColors[0] = null; mCachedBitmapWithColors[1] = null; } // store the new key and bitmap mCachedKey = key; mCachedBitmap[targetIndex] = bitmap; mCachedBitmapWithColors[targetIndex] = bitmap; return bitmap; } Loading
src/com/cyanogenmod/eleven/appwidgets/AppWidgetLarge.java +1 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ public class AppWidgetLarge extends AppWidgetBase { final CharSequence trackName = service.getTrackName(); final CharSequence artistName = service.getArtistName(); final CharSequence albumName = service.getAlbumName(); final Bitmap bitmap = service.getAlbumArt(true); final Bitmap bitmap = service.getAlbumArt(true).getBitmap(); // Set the titles and artwork appWidgetView.setTextViewText(R.id.app_widget_large_line_one, trackName); Loading
src/com/cyanogenmod/eleven/appwidgets/AppWidgetLargeAlternate.java +1 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class AppWidgetLargeAlternate extends AppWidgetBase { final CharSequence trackName = service.getTrackName(); final CharSequence artistName = service.getArtistName(); final CharSequence albumName = service.getAlbumName(); final Bitmap bitmap = service.getAlbumArt(true); final Bitmap bitmap = service.getAlbumArt(true).getBitmap(); // Set the titles and artwork appWidgetView.setTextViewText(R.id.app_widget_large_alternate_line_one, trackName); Loading
src/com/cyanogenmod/eleven/appwidgets/AppWidgetSmall.java +1 −1 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ public class AppWidgetSmall extends AppWidgetBase { final CharSequence trackName = service.getTrackName(); final CharSequence artistName = service.getArtistName(); final Bitmap bitmap = service.getAlbumArt(true); final Bitmap bitmap = service.getAlbumArt(true).getBitmap(); // Set the titles and artwork if (TextUtils.isEmpty(trackName) && TextUtils.isEmpty(artistName)) { Loading