Added option to disable the blurred album cover on the lockscreen

This commit is contained in:
Karim Abou Zeid 2015-12-27 20:28:18 +01:00
commit 59ed9c4459
4 changed files with 26 additions and 7 deletions

View file

@ -141,6 +141,8 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
private boolean notHandledMetaChangedForCurrentTrack;
private boolean isServiceInUse;
private BlurProcessor blurProcessor = new BlurProcessor.Builder(this).build();
private static String getTrackUri(@NonNull Song song) {
return MusicUtil.getSongUri(song.id).toString();
}
@ -430,10 +432,10 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
}
private void updateRemoteControlClient() {
updateRemoteControlClientImpl(PreferenceUtil.getInstance(this).albumArtOnLockscreen());
updateRemoteControlClient(PreferenceUtil.getInstance(this).albumArtOnLockscreen(), PreferenceUtil.getInstance(this).blurredAlbumArt());
}
private void updateRemoteControlClientImpl(boolean showAlbumArt) {
private void updateRemoteControlClient(boolean showAlbumArt, boolean blurAlbumArt) {
final Song song = getCurrentSong();
remoteControlClient
.editMetadata(!showAlbumArt)
@ -447,7 +449,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
ImageLoader.getInstance().displayImage(
currentAlbumArtUri,
new NonViewAware(new ImageSize(screenSize.x, screenSize.y), ViewScaleType.CROP),
new DisplayImageOptions.Builder().postProcessor(new BlurProcessor.Builder(this).build()).build(),
new DisplayImageOptions.Builder().postProcessor(blurAlbumArt ? blurProcessor : null).build(),
new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, @Nullable Bitmap loadedImage) {
@ -914,7 +916,8 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
}
break;
case PreferenceUtil.ALBUM_ART_ON_LOCKSCREEN:
updateRemoteControlClientImpl(sharedPreferences.getBoolean(key, true));
case PreferenceUtil.BLURRED_ALBUM_ART:
updateRemoteControlClient();
break;
case PreferenceUtil.COLORED_NOTIFICATION:
playingNotificationHelper.updateNotification(sharedPreferences.getBoolean(key, false));

View file

@ -53,6 +53,7 @@ public final class PreferenceUtil {
public static final String LAST_ADDED_CUTOFF_TIMESTAMP = "last_added_cutoff_timestamp";
public static final String ALBUM_ART_ON_LOCKSCREEN = "album_art_on_lockscreen";
public static final String BLURRED_ALBUM_ART = "blurred_album_art";
public static final String LAST_SLEEP_TIMER_VALUE = "last_sleep_timer_value";
public static final String NEXT_SLEEP_TIMER_ELAPSED_REALTIME = "next_sleep_timer_elapsed_real_time";
@ -195,6 +196,10 @@ public final class PreferenceUtil {
return mPreferences.getBoolean(ALBUM_ART_ON_LOCKSCREEN, true);
}
public final boolean blurredAlbumArt() {
return mPreferences.getBoolean(BLURRED_ALBUM_ART, false);
}
public final boolean ignoreMediaStoreArtwork() {
return mPreferences.getBoolean(IGNORE_MEDIA_STORE_ARTWORK, false);
}

View file

@ -100,7 +100,8 @@
<string name="pref_header_lockscreen">Lockscreen</string>
<string name="pref_title_navigation_bar">Colored navigation bar</string>
<string name="pref_title_set_default_start_page">Start page</string>
<string name="pref_title_album_art_on_lockscreen">Album cover on lockscreen</string>
<string name="pref_title_album_art_on_lockscreen">Show album cover</string>
<string name="pref_title_blurred_album_art">Blur album cover</string>
<string name="pref_title_colored_notification">Colored notification</string>
<string name="pref_title_ignore_media_store_artwork">Ignore Media Store covers</string>
<string name="pref_title_gapless_playback">Gapless playback</string>
@ -136,6 +137,7 @@
<string name="song">Song</string>
<string name="pref_only_lollipop">"Only available on Lollipop."</string>
<string name="pref_summary_album_art_on_lockscreen">Uses the current songs album cover as lockscreen wallpaper.</string>
<string name="pref_summary_blurred_album_art">Blurs the album cover on the lockscreen. Can cause problems with third party widgets and apps.</string>
<string name="pref_summary_colored_notification">"Colors the notification in the album cover\u2019s vibrant color."</string>
<string name="pref_summary_gapless_playback">"Can cause playback issues on some devices."</string>
<string name="pref_summary_force_square_album_art">Album covers in the now playing view are always squared.</string>

View file

@ -3,11 +3,20 @@
<com.kabouzeid.gramophone.prefs.DynamicPreferenceCategory android:title="@string/pref_header_lockscreen">
<CheckBoxPreference
android:layout="@layout/preference_custom"
android:defaultValue="true"
android:key="album_art_on_lockscreen"
android:title="@string/pref_title_album_art_on_lockscreen"
android:layout="@layout/preference_custom"
android:summary="@string/pref_summary_album_art_on_lockscreen"
android:title="@string/pref_title_album_art_on_lockscreen"
android:widgetLayout="@layout/preference_dynamic_checkbox" />
<CheckBoxPreference
android:defaultValue="false"
android:dependency="album_art_on_lockscreen"
android:key="blurred_album_art"
android:layout="@layout/preference_custom"
android:summary="@string/pref_summary_blurred_album_art"
android:title="@string/pref_title_blurred_album_art"
android:widgetLayout="@layout/preference_dynamic_checkbox" />
</com.kabouzeid.gramophone.prefs.DynamicPreferenceCategory>