Fix Crashes and ANRs from Play Store
This commit is contained in:
parent
b44f249cd5
commit
1f6fa55bbb
|
@ -991,14 +991,20 @@ public class DownloadServiceImpl extends Service implements DownloadService {
|
||||||
UltraSonicAppWidgetProvider4x3.getInstance().notifyChange(this, this, this.playerState == PlayerState.STARTED, false);
|
UltraSonicAppWidgetProvider4x3.getInstance().notifyChange(this, this, this.playerState == PlayerState.STARTED, false);
|
||||||
UltraSonicAppWidgetProvider4x4.getInstance().notifyChange(this, this, this.playerState == PlayerState.STARTED, false);
|
UltraSonicAppWidgetProvider4x4.getInstance().notifyChange(this, this, this.playerState == PlayerState.STARTED, false);
|
||||||
SubsonicTabActivity tabInstance = SubsonicTabActivity.getInstance();
|
SubsonicTabActivity tabInstance = SubsonicTabActivity.getInstance();
|
||||||
|
|
||||||
|
Entry song = null;
|
||||||
|
|
||||||
|
if (currentPlaying != null) {
|
||||||
|
song = currentPlaying.getSong();
|
||||||
|
}
|
||||||
|
|
||||||
if (show) {
|
if (show) {
|
||||||
int size = Util.getNotificationImageSize(this);
|
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) {
|
if (tabInstance != null) {
|
||||||
tabInstance.nowPlayingImage = bitmap;
|
tabInstance.nowPlayingImage = bitmap;
|
||||||
tabInstance.showNotification(handler, currentPlaying.getSong(), this, this.notification, this.playerState);
|
tabInstance.showNotification(handler, song, this, this.notification, this.playerState);
|
||||||
tabInstance.showNowPlaying();
|
tabInstance.showNowPlaying();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -108,7 +108,6 @@ public class FileUtil {
|
||||||
if (albumArtFile.exists()) {
|
if (albumArtFile.exists()) {
|
||||||
final BitmapFactory.Options opt = new BitmapFactory.Options();
|
final BitmapFactory.Options opt = new BitmapFactory.Options();
|
||||||
|
|
||||||
|
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
opt.inJustDecodeBounds = true;
|
opt.inJustDecodeBounds = true;
|
||||||
BitmapFactory.decodeFile(albumArtFile.getPath(), opt);
|
BitmapFactory.decodeFile(albumArtFile.getPath(), opt);
|
||||||
|
|
|
@ -123,8 +123,13 @@ public class SongView extends UpdateView implements Checkable {
|
||||||
if (artistTextView != null) {
|
if (artistTextView != null) {
|
||||||
artistTextView.setText(artist);
|
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));
|
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);
|
checkedTextView.setVisibility(checkable && !song.isVideo() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue