11
11
import android .view .MenuItem ;
12
12
import android .view .View ;
13
13
import android .view .ViewGroup ;
14
- import android .widget .ImageView ;
15
14
import android .widget .TextView ;
16
15
17
16
import androidx .annotation .NonNull ;
26
25
import org .schabi .newpipe .extractor .InfoItem ;
27
26
import org .schabi .newpipe .extractor .ListExtractor ;
28
27
import org .schabi .newpipe .extractor .NewPipe ;
28
+ import org .schabi .newpipe .extractor .ServiceList ;
29
29
import org .schabi .newpipe .extractor .exceptions .ExtractionException ;
30
30
import org .schabi .newpipe .extractor .playlist .PlaylistInfo ;
31
+ import org .schabi .newpipe .extractor .services .youtube .YoutubeParsingHelper ;
31
32
import org .schabi .newpipe .extractor .stream .StreamInfoItem ;
32
33
import org .schabi .newpipe .extractor .stream .StreamType ;
33
34
import org .schabi .newpipe .fragments .list .BaseListInfoFragment ;
51
52
import java .util .List ;
52
53
import java .util .concurrent .atomic .AtomicBoolean ;
53
54
55
+ import de .hdodenhof .circleimageview .CircleImageView ;
54
56
import io .reactivex .rxjava3 .android .schedulers .AndroidSchedulers ;
55
57
import io .reactivex .rxjava3 .core .Flowable ;
56
58
import io .reactivex .rxjava3 .core .Single ;
@@ -74,7 +76,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
74
76
private TextView headerTitleView ;
75
77
private View headerUploaderLayout ;
76
78
private TextView headerUploaderName ;
77
- private ImageView headerUploaderAvatar ;
79
+ private CircleImageView headerUploaderAvatar ;
78
80
private TextView headerStreamCount ;
79
81
private View playlistCtrl ;
80
82
@@ -301,8 +303,21 @@ public void handleResult(@NonNull final PlaylistInfo result) {
301
303
302
304
playlistCtrl .setVisibility (View .VISIBLE );
303
305
304
- IMAGE_LOADER .displayImage (result .getUploaderAvatarUrl (), headerUploaderAvatar ,
305
- ImageDisplayConstants .DISPLAY_AVATAR_OPTIONS );
306
+ final String avatarUrl = result .getUploaderAvatarUrl ();
307
+ if (result .getServiceId () == ServiceList .YouTube .getServiceId ()
308
+ && (YoutubeParsingHelper .isYoutubeMixId (result .getId ())
309
+ || YoutubeParsingHelper .isYoutubeMusicMixId (result .getId ()))) {
310
+ // this is an auto-generated playlist (e.g. Youtube mix), so a radio is shown
311
+ headerUploaderAvatar .setImageResource (
312
+ ThemeHelper .resolveResourceIdFromAttr (requireContext (), R .attr .ic_radio ));
313
+ headerUploaderAvatar .setBorderColor (
314
+ getResources ().getColor (R .color .transparent_background_color ));
315
+
316
+ } else {
317
+ IMAGE_LOADER .displayImage (avatarUrl , headerUploaderAvatar ,
318
+ ImageDisplayConstants .DISPLAY_AVATAR_OPTIONS );
319
+ }
320
+
306
321
headerStreamCount .setText (Localization
307
322
.localizeStreamCount (getContext (), result .getStreamCount ()));
308
323
0 commit comments