diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index c3d3f0ea66c..006db3a6700 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -11,7 +11,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; @@ -27,7 +26,6 @@ import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ExtractionException; -import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.playlist.PlaylistInfo; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamType; @@ -50,6 +48,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import de.hdodenhof.circleimageview.CircleImageView; import io.reactivex.Flowable; import io.reactivex.Single; import io.reactivex.android.schedulers.AndroidSchedulers; @@ -74,7 +73,7 @@ public class PlaylistFragment extends BaseListInfoFragment { private TextView headerTitleView; private View headerUploaderLayout; private TextView headerUploaderName; - private ImageView headerUploaderAvatar; + private CircleImageView headerUploaderAvatar; private TextView headerStreamCount; private View playlistCtrl; @@ -302,8 +301,19 @@ public void handleResult(@NonNull final PlaylistInfo result) { playlistCtrl.setVisibility(View.VISIBLE); - IMAGE_LOADER.displayImage(result.getUploaderAvatarUrl(), headerUploaderAvatar, - ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); + String avatarUrl = result.getUploaderAvatarUrl(); + if (avatarUrl.contains("upload.wikimedia.org")) { + // this is an auto-generated playlist (e.g. Youtube mixes) with an avatar + // that could be a trademark and thus not be safe to use + headerUploaderAvatar.setImageResource( + ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_radio)); + headerUploaderAvatar.setBorderColor( + getResources().getColor(R.color.transparent_background_color)); + } else { + IMAGE_LOADER.displayImage(avatarUrl, headerUploaderAvatar, + ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); + } + headerStreamCount.setText(Localization .localizeStreamCount(getContext(), result.getStreamCount()));