6161import com .google .android .material .appbar .AppBarLayout ;
6262import com .google .android .material .bottomsheet .BottomSheetBehavior ;
6363import com .google .android .material .tabs .TabLayout ;
64- import com .squareup .picasso .Callback ;
6564
6665import org .schabi .newpipe .App ;
6766import org .schabi .newpipe .R ;
@@ -649,27 +648,6 @@ protected void initListeners() {
649648 }
650649 }
651650
652- private void initThumbnailViews (@ NonNull final StreamInfo info ) {
653- PicassoHelper .loadDetailsThumbnail (info .getThumbnailUrl ()).tag (PICASSO_VIDEO_DETAILS_TAG )
654- .into (binding .detailThumbnailImageView , new Callback () {
655- @ Override
656- public void onSuccess () {
657- // nothing to do, the image was loaded correctly into the thumbnail
658- }
659-
660- @ Override
661- public void onError (final Exception e ) {
662- showSnackBarError (new ErrorInfo (e , UserAction .LOAD_IMAGE ,
663- info .getThumbnailUrl (), info ));
664- }
665- });
666-
667- PicassoHelper .loadAvatar (info .getSubChannelAvatarUrl ()).tag (PICASSO_VIDEO_DETAILS_TAG )
668- .into (binding .detailSubChannelThumbnailView );
669- PicassoHelper .loadAvatar (info .getUploaderAvatarUrl ()).tag (PICASSO_VIDEO_DETAILS_TAG )
670- .into (binding .detailUploaderThumbnailView );
671- }
672-
673651 /*//////////////////////////////////////////////////////////////////////////
674652 // OwnStack
675653 //////////////////////////////////////////////////////////////////////////*/
@@ -1480,12 +1458,9 @@ public void handleResult(@NonNull final StreamInfo info) {
14801458 binding .detailSubChannelThumbnailView .setVisibility (View .GONE );
14811459
14821460 if (!isEmpty (info .getSubChannelName ())) {
1483- displayBothUploaderAndSubChannel (info , activity );
1484- } else if (!isEmpty (info .getUploaderName ())) {
1485- displayUploaderAsSubChannel (info , activity );
1461+ displayBothUploaderAndSubChannel (info );
14861462 } else {
1487- binding .detailUploaderTextView .setVisibility (View .GONE );
1488- binding .detailUploaderThumbnailView .setVisibility (View .GONE );
1463+ displayUploaderAsSubChannel (info );
14891464 }
14901465
14911466 final Drawable buddyDrawable =
@@ -1559,7 +1534,8 @@ public void handleResult(@NonNull final StreamInfo info) {
15591534 binding .detailSecondaryControlPanel .setVisibility (View .GONE );
15601535
15611536 checkUpdateProgressInfo (info );
1562- initThumbnailViews (info );
1537+ PicassoHelper .loadDetailsThumbnail (info .getThumbnailUrl ()).tag (PICASSO_VIDEO_DETAILS_TAG )
1538+ .into (binding .detailThumbnailImageView );
15631539 showMetaInfoInTextView (info .getMetaInfo (), binding .detailMetaInfoTextView ,
15641540 binding .detailMetaInfoSeparator , disposables );
15651541
@@ -1596,27 +1572,30 @@ public void handleResult(@NonNull final StreamInfo info) {
15961572 noVideoStreams ? R .drawable .ic_headset_shadow : R .drawable .ic_play_arrow_shadow );
15971573 }
15981574
1599- private void displayUploaderAsSubChannel (final StreamInfo info , final Context context ) {
1575+ private void displayUploaderAsSubChannel (final StreamInfo info ) {
16001576 binding .detailSubChannelTextView .setText (info .getUploaderName ());
16011577 binding .detailSubChannelTextView .setVisibility (View .VISIBLE );
16021578 binding .detailSubChannelTextView .setSelected (true );
16031579
16041580 if (info .getUploaderSubscriberCount () > -1 ) {
16051581 binding .detailUploaderTextView .setText (
1606- Localization .shortSubscriberCount (context , info .getUploaderSubscriberCount ()));
1582+ Localization .shortSubscriberCount (activity , info .getUploaderSubscriberCount ()));
16071583 binding .detailUploaderTextView .setVisibility (View .VISIBLE );
16081584 } else {
16091585 binding .detailUploaderTextView .setVisibility (View .GONE );
16101586 }
1587+
1588+ PicassoHelper .loadAvatar (info .getUploaderAvatarUrl ()).tag (PICASSO_VIDEO_DETAILS_TAG )
1589+ .into (binding .detailSubChannelThumbnailView );
1590+ binding .detailSubChannelThumbnailView .setVisibility (View .VISIBLE );
1591+ binding .detailUploaderThumbnailView .setVisibility (View .GONE );
16111592 }
16121593
1613- private void displayBothUploaderAndSubChannel (final StreamInfo info , final Context context ) {
1594+ private void displayBothUploaderAndSubChannel (final StreamInfo info ) {
16141595 binding .detailSubChannelTextView .setText (info .getSubChannelName ());
16151596 binding .detailSubChannelTextView .setVisibility (View .VISIBLE );
16161597 binding .detailSubChannelTextView .setSelected (true );
16171598
1618- binding .detailSubChannelThumbnailView .setVisibility (View .VISIBLE );
1619-
16201599 final StringBuilder subText = new StringBuilder ();
16211600 if (!isEmpty (info .getUploaderName ())) {
16221601 subText .append (
@@ -1627,7 +1606,7 @@ private void displayBothUploaderAndSubChannel(final StreamInfo info, final Conte
16271606 subText .append (Localization .DOT_SEPARATOR );
16281607 }
16291608 subText .append (
1630- Localization .shortSubscriberCount (context , info .getUploaderSubscriberCount ()));
1609+ Localization .shortSubscriberCount (activity , info .getUploaderSubscriberCount ()));
16311610 }
16321611
16331612 if (subText .length () > 0 ) {
@@ -1637,6 +1616,13 @@ private void displayBothUploaderAndSubChannel(final StreamInfo info, final Conte
16371616 } else {
16381617 binding .detailUploaderTextView .setVisibility (View .GONE );
16391618 }
1619+
1620+ PicassoHelper .loadAvatar (info .getSubChannelAvatarUrl ()).tag (PICASSO_VIDEO_DETAILS_TAG )
1621+ .into (binding .detailSubChannelThumbnailView );
1622+ binding .detailSubChannelThumbnailView .setVisibility (View .VISIBLE );
1623+ PicassoHelper .loadAvatar (info .getUploaderAvatarUrl ()).tag (PICASSO_VIDEO_DETAILS_TAG )
1624+ .into (binding .detailUploaderThumbnailView );
1625+ binding .detailUploaderThumbnailView .setVisibility (View .VISIBLE );
16401626 }
16411627
16421628 public void openDownloadDialog () {
0 commit comments