Fix background gradient when changing themes

This commit is contained in:
Andrew Rabert 2019-12-22 15:22:10 -05:00
parent 4eac05e57f
commit f623ad2b63
2 changed files with 18 additions and 7 deletions

View File

@ -87,7 +87,8 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
private TextView emptyTextView;
private TextView songTitleTextView;
private ImageView albumArtImageView;
private ImageView albumArtBackgroundView;
private View albumArtBackgroundView;
private ImageView albumArtBackgroundImageView;
private View nowPlayingView;
private RecyclerView playlistView;
private TextView positionTextView;
@ -156,6 +157,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
songTitleTextView = rootView.findViewById(R.id.download_song_title);
albumArtImageView = rootView.findViewById(R.id.download_album_art_image);
albumArtBackgroundView = rootView.findViewById(R.id.download_album_art_background);
albumArtBackgroundImageView = rootView.findViewById(R.id.download_album_art_background_image);
nowPlayingView = rootView.findViewById(R.id.now_playing_top);
positionTextView = rootView.findViewById(R.id.download_position);
durationTextView = rootView.findViewById(R.id.download_duration);
@ -939,11 +941,9 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
getImageLoader().loadImage(albumArtImageView, song, true, crossfade);
if (Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_BLURRED_BACKGROUND, true)) {
albumArtBackgroundView.setVisibility(ImageView.VISIBLE);
nowPlayingView.setBackgroundResource(DrawableTint.getDrawableRes(context, R.attr.gradient));
getImageLoader().loadBlurImage(albumArtBackgroundView, song, true, crossfade);
getImageLoader().loadBlurImage(albumArtBackgroundImageView, song, true, crossfade);
} else {
albumArtBackgroundView.setVisibility(ImageView.GONE);
nowPlayingView.setBackgroundResource(0);
}
}

View File

@ -3,11 +3,22 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<net.nullsum.audinaut.view.RecyclingImageView
<FrameLayout
android:id="@+id/download_album_art_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
android:layout_height="match_parent" >
<net.nullsum.audinaut.view.RecyclingImageView
android:id="@+id/download_album_art_background_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?gradient" />
</FrameLayout>
<LinearLayout
android:id="@+id/now_playing_top"