Skip to content

Commit a18ebf6

Browse files
committed
Show radio instead of Youtube logo in mixes
YouTube mixes have YouTube as a creator, though YouTube's logo is not safe to use as it is a trademark (better safe than sorry)
1 parent 0ced9ba commit a18ebf6

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ dependencies {
175175

176176
// NewPipe dependencies
177177
// You can use a local version by uncommenting a few lines in settings.gradle
178-
implementation 'com.github.TeamNewPipe:NewPipeExtractor:b3835bd616ab28b861c83dcefd56e1754c6d20be'
178+
implementation 'com.github.TeamNewPipe:NewPipeExtractor:85fa006214b003f21eacb76c445a167732f19981'
179179
implementation "com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751"
180180

181181
implementation "org.jsoup:jsoup:1.13.1"

app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java

+19-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import android.view.MenuItem;
1212
import android.view.View;
1313
import android.view.ViewGroup;
14-
import android.widget.ImageView;
1514
import android.widget.TextView;
1615

1716
import androidx.annotation.NonNull;
@@ -26,8 +25,10 @@
2625
import org.schabi.newpipe.extractor.InfoItem;
2726
import org.schabi.newpipe.extractor.ListExtractor;
2827
import org.schabi.newpipe.extractor.NewPipe;
28+
import org.schabi.newpipe.extractor.ServiceList;
2929
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
3030
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
31+
import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper;
3132
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
3233
import org.schabi.newpipe.extractor.stream.StreamType;
3334
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
@@ -51,6 +52,7 @@
5152
import java.util.List;
5253
import java.util.concurrent.atomic.AtomicBoolean;
5354

55+
import de.hdodenhof.circleimageview.CircleImageView;
5456
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
5557
import io.reactivex.rxjava3.core.Flowable;
5658
import io.reactivex.rxjava3.core.Single;
@@ -74,7 +76,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
7476
private TextView headerTitleView;
7577
private View headerUploaderLayout;
7678
private TextView headerUploaderName;
77-
private ImageView headerUploaderAvatar;
79+
private CircleImageView headerUploaderAvatar;
7880
private TextView headerStreamCount;
7981
private View playlistCtrl;
8082

@@ -301,8 +303,21 @@ public void handleResult(@NonNull final PlaylistInfo result) {
301303

302304
playlistCtrl.setVisibility(View.VISIBLE);
303305

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+
306321
headerStreamCount.setText(Localization
307322
.localizeStreamCount(getContext(), result.getStreamCount()));
308323

0 commit comments

Comments
 (0)