Add blurred album art toggle

This commit is contained in:
Andrew Rabert 2018-05-12 11:27:03 -04:00
parent 092e2b4f6b
commit ec15274984
4 changed files with 23 additions and 8 deletions

View File

@ -519,8 +519,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
}
if (currentPlaying == null && downloadService != null && null == downloadService.getCurrentPlaying()) {
getImageLoader().loadBlurImage(albumArtBackgroundView, null, true, false);
getImageLoader().loadImage(albumArtImageView, null, true, false);
setAlbumArt(null, false);
}
context.runWhenServiceAvailable(() -> {
@ -808,8 +807,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
if (currentPlaying != null) {
Entry song = currentPlaying.getSong();
songTitleTextView.setText(song.getTitle());
getImageLoader().loadBlurImage(albumArtBackgroundView, song, true, true);
getImageLoader().loadImage(albumArtImageView, song, true, true);
setAlbumArt(song, true);
DownloadService downloadService = getDownloadService();
if (downloadService.isShufflePlayEnabled()) {
@ -819,8 +817,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
}
} else {
songTitleTextView.setText(null);
getImageLoader().loadBlurImage(albumArtBackgroundView, null, true, false);
getImageLoader().loadImage(albumArtImageView, null, true, false);
setAlbumArt(null, false);
setSubtitle(null);
}
}
@ -942,11 +939,20 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
}
}
private void setAlbumArt(Entry song, Boolean crossfade) {
getImageLoader().loadImage(albumArtImageView, song, true, crossfade);
if (Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_BLURRED_BACKGROUND, true)) {
albumArtBackgroundView.setVisibility(ImageView.VISIBLE);
getImageLoader().loadBlurImage(albumArtBackgroundView, song, true, crossfade);
} else {
albumArtBackgroundView.setVisibility(ImageView.GONE);
}
}
@Override
public void onMetadataUpdate(Entry song, int fieldChange) {
if (song != null && albumArtImageView != null && fieldChange == DownloadService.METADATA_UPDATED_COVER_ART) {
getImageLoader().loadBlurImage(albumArtBackgroundView, song, true, true);
getImageLoader().loadImage(albumArtImageView, song, true, true);
setAlbumArt(song, true);
}
}

View File

@ -110,6 +110,7 @@ public final class Constants {
// public static final String PREFERENCES_KEY_PLAY_NOW_AFTER = "playNowAfter";
public static final String PREFERENCES_KEY_SONG_PRESS_ACTION = "songPressAction";
public static final String PREFERENCES_KEY_LARGE_ALBUM_ART = "largeAlbumArt";
public static final String PREFERENCES_KEY_BLURRED_BACKGROUND = "blurredBackground";
public static final String PREFERENCES_KEY_PLAYLIST_NAME = "suggestedPlaylistName";
public static final String PREFERENCES_KEY_PLAYLIST_ID = "suggestedPlaylistId";
public static final String PREFERENCES_KEY_RECENT_COUNT = "mostRecentCount";

View File

@ -232,6 +232,8 @@
<string name="settings.song_press_play_last">Adds song to end of Now Playing Queue</string>
<string name="settings.large_album_art">Large Album Art</string>
<string name="settings.large_album_art_summary">Display albums with large album art instead of in a list</string>
<string name="settings.blurred_background">Blurred Background</string>
<string name="settings.blurred_background_summary">Display blurred album art in the background of the now playing screen</string>
<string name="settings.replay_gain">Replay Gain</string>
<string name="settings.replay_gain_summary">Whether or not to scale playback volume by track and album replay gain tags</string>
<string name="settings.replay_gain_type">Read from tags</string>

View File

@ -49,5 +49,11 @@
android:key="largeAlbumArt"
android:summary="@string/settings.large_album_art_summary"
android:title="@string/settings.large_album_art" />
<CheckBoxPreference
android:defaultValue="true"
android:key="blurredBackground"
android:summary="@string/settings.blurred_background_summary"
android:title="@string/settings.blurred_background" />
</PreferenceCategory>
</PreferenceScreen>