option to disable artwork on lockscreen
This commit is contained in:
parent
8c0b72e323
commit
7f1f5c0cdd
@ -236,6 +236,9 @@ THE SOFTWARE.
|
||||
<string name="coverloader_shadow_title">Load artwork from hidden folder</string>
|
||||
<string name="coverloader_shadow_summary">Try to load artwork from \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string>
|
||||
|
||||
<string name="cover_on_lockscreen_title">Show artwork on lockscreen</string>
|
||||
<string name="cover_on_lockscreen_summary">Display the artwork of the currently playing song on the lockscreen</string>
|
||||
|
||||
<string name="double_tap_title">Double Tap Widget</string>
|
||||
<string name="double_tap_summary">Double-tapping the 1x1 widget will open the player. Incurs a 400ms delay before the widget responds to actions.</string>
|
||||
<string name="scrobble_title">Use ScrobbleDroid API</string>
|
||||
|
@ -40,4 +40,10 @@ THE SOFTWARE.
|
||||
android:title="@string/coverloader_android_title"
|
||||
android:summary="@string/coverloader_android_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="cover_on_lockscreen"
|
||||
android:title="@string/cover_on_lockscreen_title"
|
||||
android:summary="@string/cover_on_lockscreen_summary"
|
||||
android:defaultValue="true" />
|
||||
</PreferenceScreen>
|
||||
|
@ -834,6 +834,8 @@ public final class PlaybackService extends Service
|
||||
mScrobble = settings.getBoolean(PrefKeys.SCROBBLE, PrefDefaults.SCROBBLE);
|
||||
} else if (PrefKeys.MEDIA_BUTTON.equals(key) || PrefKeys.MEDIA_BUTTON_BEEP.equals(key)) {
|
||||
MediaButtonReceiver.reloadPreference(this);
|
||||
} else if (PrefKeys.COVER_ON_LOCKSCREEN.equals(key)) {
|
||||
RemoteControl.reloadPreference();
|
||||
} else if (PrefKeys.USE_IDLE_TIMEOUT.equals(key) || PrefKeys.IDLE_TIMEOUT.equals(key)) {
|
||||
mIdleTimeout = settings.getBoolean(PrefKeys.USE_IDLE_TIMEOUT, PrefDefaults.USE_IDLE_TIMEOUT) ? settings.getInt(PrefKeys.IDLE_TIMEOUT, PrefDefaults.IDLE_TIMEOUT) : 0;
|
||||
userActionTriggered();
|
||||
|
@ -33,6 +33,7 @@ public class PrefDefaults {
|
||||
public static final boolean COVERLOADER_ANDROID = true;
|
||||
public static final boolean COVERLOADER_VANILLA = true;
|
||||
public static final boolean COVERLOADER_SHADOW = true;
|
||||
public static final boolean COVER_ON_LOCKSCREEN = true;
|
||||
public static final boolean DISABLE_LOCKSCREEN = false;
|
||||
public static final String DISPLAY_MODE = "2";
|
||||
public static final boolean DOUBLE_TAP = false;
|
||||
|
@ -34,6 +34,7 @@ public class PrefKeys {
|
||||
public static final String COVERLOADER_ANDROID = "coverloader_android";
|
||||
public static final String COVERLOADER_VANILLA = "coverloader_vanilla";
|
||||
public static final String COVERLOADER_SHADOW = "coverloader_shadow";
|
||||
public static final String COVER_ON_LOCKSCREEN = "cover_on_lockscreen";
|
||||
public static final String DISABLE_LOCKSCREEN = "disable_lockscreen";
|
||||
public static final String DISPLAY_MODE = "display_mode";
|
||||
public static final String DOUBLE_TAP = "double_tap";
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch>
|
||||
* Copyright (C) 2012 Christopher Eby <kreed@kreed.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -26,6 +27,7 @@ import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
@ -37,6 +39,11 @@ public class RemoteControl {
|
||||
* Used with updateRemote method.
|
||||
*/
|
||||
private static RemoteControlClient sRemote;
|
||||
/**
|
||||
* Whether the cover should be shown. 1 for yes, 0 for no, -1 for
|
||||
* uninitialized.
|
||||
*/
|
||||
private static int sShowCover = -1;
|
||||
|
||||
/**
|
||||
* Perform initialization required for RemoteControlClient.
|
||||
@ -67,6 +74,14 @@ public class RemoteControl {
|
||||
sRemote = remote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninitializes our cached preferences, forcing a reload
|
||||
*/
|
||||
public static void reloadPreference()
|
||||
{
|
||||
sShowCover = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the remote with new metadata.
|
||||
* {@link #registerRemote(Context, AudioManager)} must have been called
|
||||
@ -85,6 +100,11 @@ public class RemoteControl {
|
||||
|
||||
boolean isPlaying = ((state & PlaybackService.FLAG_PLAYING) != 0);
|
||||
|
||||
if (sShowCover == -1) {
|
||||
SharedPreferences settings = PlaybackService.getSettings(context);
|
||||
sShowCover = settings.getBoolean(PrefKeys.COVER_ON_LOCKSCREEN, PrefDefaults.COVER_ON_LOCKSCREEN) ? 1 : 0;
|
||||
}
|
||||
|
||||
remote.setPlaybackState(isPlaying ? RemoteControlClient.PLAYSTATE_PLAYING : RemoteControlClient.PLAYSTATE_PAUSED);
|
||||
RemoteControlClient.MetadataEditor editor = remote.editMetadata(true);
|
||||
if (song != null) {
|
||||
@ -92,7 +112,7 @@ public class RemoteControl {
|
||||
editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, song.album);
|
||||
editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, song.title);
|
||||
Bitmap bitmap = song.getCover(context);
|
||||
if (bitmap != null && (isPlaying || keepPaused)) {
|
||||
if (bitmap != null && sShowCover == 1 && (isPlaying || keepPaused)) {
|
||||
// Create a copy of the cover art, since RemoteControlClient likes
|
||||
// to recycle what we give it.
|
||||
bitmap = bitmap.copy(Bitmap.Config.RGB_565, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user