Slight cover optimization for widgets
This commit is contained in:
parent
d1837655a2
commit
eaf2faac2c
@ -28,6 +28,7 @@ import android.appwidget.AppWidgetProvider;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
@ -105,10 +106,11 @@ public class FourLongWidget extends AppWidgetProvider {
|
||||
views.setViewVisibility(R.id.buttons, View.VISIBLE);
|
||||
views.setTextViewText(R.id.title, song.title);
|
||||
views.setTextViewText(R.id.artist, song.artist);
|
||||
if (Song.mDisableCoverArt)
|
||||
Uri uri = song.getCoverUri();
|
||||
if (uri == null)
|
||||
views.setImageViewResource(R.id.cover, 0);
|
||||
else
|
||||
views.setImageViewUri(R.id.cover, song.getCoverUri());
|
||||
views.setImageViewUri(R.id.cover, uri);
|
||||
}
|
||||
|
||||
boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0;
|
||||
|
@ -28,6 +28,7 @@ import android.appwidget.AppWidgetProvider;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
@ -105,10 +106,11 @@ public class FourSquareWidget extends AppWidgetProvider {
|
||||
views.setViewVisibility(R.id.buttons, View.VISIBLE);
|
||||
views.setTextViewText(R.id.title, song.title);
|
||||
views.setTextViewText(R.id.artist, song.artist);
|
||||
if (Song.mDisableCoverArt)
|
||||
Uri uri = song.getCoverUri();
|
||||
if (uri == null)
|
||||
views.setImageViewResource(R.id.cover, 0);
|
||||
else
|
||||
views.setImageViewUri(R.id.cover, song.getCoverUri());
|
||||
views.setImageViewUri(R.id.cover, uri);
|
||||
}
|
||||
|
||||
boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0;
|
||||
|
@ -29,6 +29,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
/**
|
||||
@ -113,10 +114,11 @@ public class OneCellWidget extends AppWidgetProvider {
|
||||
views.setImageViewResource(R.id.cover, 0);
|
||||
views.setInt(R.id.title, "setText", R.string.app_name);
|
||||
} else {
|
||||
if (Song.mDisableCoverArt)
|
||||
Uri uri = song.getCoverUri();
|
||||
if (uri == null)
|
||||
views.setImageViewResource(R.id.cover, 0);
|
||||
else
|
||||
views.setImageViewUri(R.id.cover, song.getCoverUri());
|
||||
views.setImageViewUri(R.id.cover, uri);
|
||||
views.setTextViewText(R.id.title, song.title);
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ public class Song implements Comparable<Song> {
|
||||
// Use undocumented API to extract the cover from the media file from Eclair
|
||||
// See http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/MusicUtils.java;h=d1aea0660009940a0160cb981f381e2115768845;hb=0749a3f1c11e052f97a3ba60fd624c9283ee7331#l986
|
||||
|
||||
if (id == -1)
|
||||
if (id == -1 || hasCover == 0)
|
||||
return null;
|
||||
return Uri.parse("content://media/external/audio/media/" + id + "/albumart");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user