Skip to content

Commit

Permalink
Show radio instead of Youtube logo in mixes
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Stypox committed May 21, 2020
1 parent 079b98e commit 18a2057
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ dependencies {
exclude module: 'support-annotations'
})

implementation 'com.github.TeamNewPipe:NewPipeExtractor:f3913e241e379adf0091319091e8f895c5fcfd07'
implementation 'com.github.XiangRongLin:NewPipeExtractor:5c87409b254e6707563557b7ebe7716c810b5382'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -49,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;
Expand All @@ -73,7 +73,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
private TextView headerTitleView;
private View headerUploaderLayout;
private TextView headerUploaderName;
private ImageView headerUploaderAvatar;
private CircleImageView headerUploaderAvatar;
private TextView headerStreamCount;
private View playlistCtrl;

Expand Down Expand Up @@ -301,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()));

Expand Down

0 comments on commit 18a2057

Please sign in to comment.