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" applicationId "com.kabouzeid.gramophone"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 22 targetSdkVersion 22
versionCode 22 versionCode 24
versionName "0.9.9.2b DEV" versionName "0.9.9.4b"
} }
compileOptions { compileOptions {

View file

@ -69,7 +69,8 @@ public class MusicPlayerWidget extends AppWidgetProvider {
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (currentAlbumArtUri.equals(imageUri)) 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 @Override

View file

@ -167,7 +167,8 @@ public class PlayingNotificationHelper {
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (currentAlbumArtUri.equals(imageUri)) 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 @Override

View file

@ -372,7 +372,8 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (currentAlbumArtUri.equals(imageUri)) 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 @Override
@ -793,12 +794,15 @@ public class MusicService extends Service implements MediaPlayer.OnPreparedListe
private void notifyChange(final String what) { private void notifyChange(final String what) {
//to let other apps know whats playing. i.E. last.fm (scrobbling) or musixmatch //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); final Intent intent = new Intent(what);
final int position = getPosition();
if(position >= 0) {
final Song currentSong = playingQueue.get(position);
intent.putExtra("id", currentSong.id); intent.putExtra("id", currentSong.id);
intent.putExtra("artist", currentSong.artistName); intent.putExtra("artist", currentSong.artistName);
intent.putExtra("album", currentSong.albumName); intent.putExtra("album", currentSong.albumName);
intent.putExtra("track", currentSong.title); intent.putExtra("track", currentSong.title);
}
intent.putExtra("playing", isPlaying()); intent.putExtra("playing", isPlaying());
sendStickyBroadcast(intent); sendStickyBroadcast(intent);
} }