Add option to disable cover art

This commit is contained in:
Christopher Eby 2011-08-24 00:05:18 -05:00
parent a9db1f55fb
commit 17e8e400e4
4 changed files with 16 additions and 1 deletions

View File

@ -117,6 +117,8 @@ THE SOFTWARE.
<string name="default_action_summary">What to do when an item is tapped</string>
<string name="pref_misc">Miscellaneous Features</string>
<string name="disable_cover_art_title">Disable Cover Art</string>
<string name="disable_cover_art_summary">Do not show cover art anywhere in the application</string>
<string name="use_idle_timeout_title">Enable Idle Timeout</string>
<string name="use_idle_timeout_summary">When active, playback will be stopped after the given period of inactivity</string>
<string name="idle_timeout_title">Idle Timeout</string>

View File

@ -75,6 +75,11 @@ THE SOFTWARE.
android:defaultValue="0" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_misc">
<CheckBoxPreference
android:key="disable_cover_art"
android:title="@string/disable_cover_art_title"
android:summary="@string/disable_cover_art_summary"
android:defaultValue="false" />
<CheckBoxPreference
android:key="use_idle_timeout"
android:title="@string/use_idle_timeout_title"

View File

@ -416,6 +416,7 @@ public final class PlaybackService extends Service implements Handler.Callback,
mMediaPlayer.setVolume(volume, volume);
}
mIdleTimeout = settings.getBoolean("use_idle_timeout", false) ? settings.getInt("idle_timeout", 3600) : 0;
Song.mDisableCoverArt = settings.getBoolean("disable_cover_art", false);
PowerManager powerManager = (PowerManager)getSystemService(POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VanillaMusicSongChangeLock");
@ -456,6 +457,8 @@ public final class PlaybackService extends Service implements Handler.Callback,
} else if ("use_idle_timeout".equals(key) || "idle_timeout".equals(key)) {
mIdleTimeout = settings.getBoolean("use_idle_timeout", false) ? settings.getInt("idle_timeout", 3600) : 0;
userActionTriggered();
} else if ("disable_cover_art".equals(key)) {
Song.mDisableCoverArt = settings.getBoolean("disable_cover_art", false);
}
}

View File

@ -54,6 +54,11 @@ public class Song implements Parcelable {
*/
private static final Cache<Bitmap> mCoverCache = new Cache<Bitmap>(10);
/**
* If true, will not attempt to load any cover art in getCover()
*/
public static boolean mDisableCoverArt = false;
/**
* Shuffled list of all ids in the library.
*/
@ -393,7 +398,7 @@ public class Song implements Parcelable {
*/
public Bitmap getCover()
{
if (id == -1)
if (id == -1 || mDisableCoverArt)
return null;
// Query the cache for the cover