Resolve crashes from 1.3.0.5

This commit is contained in:
Joshua Bahnsen 2014-01-26 20:43:34 -07:00
parent 36167e5ab9
commit ad7ea3cc9e
3 changed files with 24 additions and 11 deletions

View File

@ -1566,16 +1566,12 @@ public class DownloadServiceImpl extends Service implements DownloadService
String artist = currentSong.getArtist();
String album = currentSong.getAlbum();
String title = currentSong.getTitle();
//String genre = currentSong.getGenre();
//Integer track = currentSong.getTrack();
//Integer disc = currentSong.getDiscNumber();
Long duration = (long) currentSong.getDuration() * 1000;
Integer currentSongDuration = currentSong.getDuration();
Long duration = 0L;
remoteControlClient.editMetadata(true).putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, artist).putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, artist).putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, album).putString(MediaMetadataRetriever.METADATA_KEY_TITLE, title)
//.putString(MediaMetadataRetriever.METADATA_KEY_GENRE, genre)
.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, duration)
//.putLong(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER, track)
//.putLong(MediaMetadataRetriever.METADATA_KEY_DISC_NUMBER, disc)
if (currentSongDuration != null) duration = (long) currentSongDuration * 1000;
remoteControlClient.editMetadata(true).putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, artist).putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, artist).putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, album).putString(MediaMetadataRetriever.METADATA_KEY_TITLE, title).putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, duration)
.putBitmap(RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK, lockScreenBitmap).apply();
}
}

View File

@ -130,7 +130,19 @@ public class FileUtil
File albumArtFile = getAlbumArtFile(context, entry);
Bitmap bitmap = SubsonicTabActivity.getInstance().getImageLoader().getImageBitmap(entry, true, size);
SubsonicTabActivity subsonicTabActivity = SubsonicTabActivity.getInstance();
Bitmap bitmap = null;
ImageLoader imageLoader = null;
if (subsonicTabActivity != null)
{
imageLoader = subsonicTabActivity.getImageLoader();
if (imageLoader != null)
{
bitmap = imageLoader.getImageBitmap(entry, true, size);
}
}
if (bitmap != null)
{
@ -162,7 +174,10 @@ public class FileUtil
if (bitmap != null)
{
SubsonicTabActivity.getInstance().getImageLoader().addImageToCache(bitmap, entry, size);
if (imageLoader != null)
{
imageLoader.addImageToCache(bitmap, entry, size);
}
}
return bitmap == null ? null : bitmap;

View File

@ -135,6 +135,8 @@ public class ImageLoader implements Runnable
public void loadImage(View view, MusicDirectory.Entry entry, boolean large, int size, boolean crossFade, boolean highQuality)
{
view.invalidate();
if (entry == null)
{
setUnknownImage(view, large);