Fix Crashes and ANRs from Play Store

This commit is contained in:
Joshua Bahnsen 2013-07-18 00:58:59 -07:00
parent b44f249cd5
commit 1f6fa55bbb
3 changed files with 16 additions and 6 deletions

View File

@ -991,14 +991,20 @@ public class DownloadServiceImpl extends Service implements DownloadService {
UltraSonicAppWidgetProvider4x3.getInstance().notifyChange(this, this, this.playerState == PlayerState.STARTED, false);
UltraSonicAppWidgetProvider4x4.getInstance().notifyChange(this, this, this.playerState == PlayerState.STARTED, false);
SubsonicTabActivity tabInstance = SubsonicTabActivity.getInstance();
Entry song = null;
if (currentPlaying != null) {
song = currentPlaying.getSong();
}
if (show) {
int size = Util.getNotificationImageSize(this);
Bitmap bitmap = FileUtil.getAlbumArtBitmap(this, currentPlaying.getSong(), size, true);
Bitmap bitmap = FileUtil.getAlbumArtBitmap(this, song , size, true);
if (tabInstance != null) {
tabInstance.nowPlayingImage = bitmap;
tabInstance.showNotification(handler, currentPlaying.getSong(), this, this.notification, this.playerState);
tabInstance.showNotification(handler, song, this, this.notification, this.playerState);
tabInstance.showNowPlaying();
}
} else {

View File

@ -108,7 +108,6 @@ public class FileUtil {
if (albumArtFile.exists()) {
final BitmapFactory.Options opt = new BitmapFactory.Options();
if (size > 0) {
opt.inJustDecodeBounds = true;
BitmapFactory.decodeFile(albumArtFile.getPath(), opt);

View File

@ -123,8 +123,13 @@ public class SongView extends UpdateView implements Checkable {
if (artistTextView != null) {
artistTextView.setText(artist);
}
durationTextView.setText(Util.formatTotalDuration(song.getDuration()));
Integer duration = song.getDuration();
if (duration != null) {
durationTextView.setText(Util.formatTotalDuration(duration));
}
starImageView.setImageDrawable(song.getStarred() ? Util.getDrawableFromAttribute(getContext(), R.attr.star_full) : Util.getDrawableFromAttribute(getContext(), R.attr.star_hollow));
checkedTextView.setVisibility(checkable && !song.isVideo() ? View.VISIBLE : View.GONE);