Fixed two FCs. (1. bitmap recycled 2. ArrayList OOB)

This commit is contained in:
Karim Abou Zeid 2015-05-21 14:50:04 +02:00
commit fe3657707b
4 changed files with 16 additions and 10 deletions

View file

@ -24,8 +24,8 @@ android {
applicationId "com.kabouzeid.gramophone"
minSdkVersion 16
targetSdkVersion 22
versionCode 22
versionName "0.9.9.2b DEV"
versionCode 24
versionName "0.9.9.4b"
}
compileOptions {

View file

@ -69,7 +69,8 @@ public class MusicPlayerWidget extends AppWidgetProvider {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (currentAlbumArtUri.equals(imageUri))
setAlbumArt(context, loadedImage);
// copy() prevents the original bitmap in the memory cache from being recycled by the remote views
setAlbumArt(context, loadedImage.copy(loadedImage.getConfig(), true));
}
@Override

View file

@ -167,7 +167,8 @@ public class PlayingNotificationHelper {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (currentAlbumArtUri.equals(imageUri))
setAlbumArt(loadedImage);
// copy() prevents the original bitmap in the memory cache from being recycled by the remote views
setAlbumArt(loadedImage.copy(loadedImage.getConfig(), true));
}
@Override

View file

@ -372,7 +372,8 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (currentAlbumArtUri.equals(imageUri))
updateRemoteControlClientBitmap(loadedImage);
// copy() prevents the original bitmap in the memory cache from being recycled by the remote control client
updateRemoteControlClientBitmap(loadedImage.copy(loadedImage.getConfig(), true));
}
@Override
@ -793,12 +794,15 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
private void notifyChange(final String what) {
//to let other apps know whats playing. i.E. last.fm (scrobbling) or musixmatch
final Song currentSong = playingQueue.get(getPosition());
final Intent intent = new Intent(what);
intent.putExtra("id", currentSong.id);
intent.putExtra("artist", currentSong.artistName);
intent.putExtra("album", currentSong.albumName);
intent.putExtra("track", currentSong.title);
final int position = getPosition();
if(position >= 0) {
final Song currentSong = playingQueue.get(position);
intent.putExtra("id", currentSong.id);
intent.putExtra("artist", currentSong.artistName);
intent.putExtra("album", currentSong.albumName);
intent.putExtra("track", currentSong.title);
}
intent.putExtra("playing", isPlaying());
sendStickyBroadcast(intent);
}