From 1429774487f32b5cba578d89a89d3ecf14f09162 Mon Sep 17 00:00:00 2001 From: Roy Yosef Date: Mon, 13 Apr 2020 23:40:44 +0300 Subject: [PATCH 1/7] Add sub-channel details to video detail fragment --- app/build.gradle | 1 + .../fragments/detail/VideoDetailFragment.java | 95 +++++++++++++++---- .../fragment_video_detail.xml | 78 +++++++++++---- .../main/res/layout/fragment_video_detail.xml | 80 ++++++++++++---- app/src/main/res/values-land/dimens.xml | 4 +- app/src/main/res/values-sw600dp/dimens.xml | 4 +- app/src/main/res/values/dimens.xml | 8 +- app/src/main/res/values/strings.xml | 1 + settings.gradle | 6 ++ 9 files changed, 211 insertions(+), 66 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d91a4bba7..ecbdc150b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -66,6 +66,7 @@ android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 + encoding 'utf-8' } // Required and used only by groupie diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 35352c013..b6e53e74d 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -172,9 +172,10 @@ public class VideoDetailFragment extends BaseStateFragment private TextView videoUploadDateView; private TextView videoDescriptionView; - private View uploaderRootLayout; private TextView uploaderTextView; private ImageView uploaderThumb; + private TextView parentChannelTextView; + private ImageView parentChannelThumb; private TextView thumbsUpTextView; private ImageView thumbsUpImageView; @@ -418,19 +419,25 @@ public class VideoDetailFragment extends BaseStateFragment this.openDownloadDialog(); } break; - case R.id.detail_uploader_root_layout: + case R.id.detail_parent_channel_text_view: + case R.id.detail_parent_channel_thumbnail_view: + if (TextUtils.isEmpty(currentInfo.getParentChannelUrl())) { + Log.w(TAG, "Can't open parent's channel because we got no channel URL"); + + if (!TextUtils.isEmpty(currentInfo.getUploaderUrl())) { + openChannel(currentInfo.getUploaderUrl(), currentInfo.getUploaderName()); + } + } else { + openChannel(currentInfo.getParentChannelUrl(), + currentInfo.getParentChannelName()); + } + break; + case R.id.detail_uploader_text_view: + case R.id.detail_uploader_thumbnail_view: if (TextUtils.isEmpty(currentInfo.getUploaderUrl())) { Log.w(TAG, "Can't open channel because we got no channel URL"); } else { - try { - NavigationHelper.openChannelFragment( - getFragmentManager(), - currentInfo.getServiceId(), - currentInfo.getUploaderUrl(), - currentInfo.getUploaderName()); - } catch (Exception e) { - ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); - } + openChannel(currentInfo.getUploaderUrl(), currentInfo.getUploaderName()); } break; case R.id.detail_thumbnail_root_layout: @@ -447,6 +454,18 @@ public class VideoDetailFragment extends BaseStateFragment } } + private void openChannel(final String parentChannelUrl, final String parentChannelName) { + try { + NavigationHelper.openChannelFragment( + getFragmentManager(), + currentInfo.getServiceId(), + parentChannelUrl, + parentChannelName); + } catch (Exception e) { + ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); + } + } + @Override public boolean onLongClick(final View v) { if (isLoading.get() || currentInfo == null) { @@ -522,9 +541,10 @@ public class VideoDetailFragment extends BaseStateFragment thumbsDownImageView = rootView.findViewById(R.id.detail_thumbs_down_img_view); thumbsDisabledTextView = rootView.findViewById(R.id.detail_thumbs_disabled_view); - uploaderRootLayout = rootView.findViewById(R.id.detail_uploader_root_layout); uploaderTextView = rootView.findViewById(R.id.detail_uploader_text_view); uploaderThumb = rootView.findViewById(R.id.detail_uploader_thumbnail_view); + parentChannelTextView = rootView.findViewById(R.id.detail_parent_channel_text_view); + parentChannelThumb = rootView.findViewById(R.id.detail_parent_channel_thumbnail_view); appBarLayout = rootView.findViewById(R.id.appbarlayout); viewPager = rootView.findViewById(R.id.viewpager); @@ -554,8 +574,12 @@ public class VideoDetailFragment extends BaseStateFragment protected void initListeners() { super.initListeners(); + uploaderTextView.setOnClickListener(this); + uploaderThumb.setOnClickListener(this); + parentChannelTextView.setOnClickListener(this); + parentChannelThumb.setOnClickListener(this); + videoTitleRoot.setOnClickListener(this); - uploaderRootLayout.setOnClickListener(this); thumbnailBackgroundButton.setOnClickListener(this); detailControlsBackground.setOnClickListener(this); detailControlsPopup.setOnClickListener(this); @@ -603,6 +627,11 @@ public class VideoDetailFragment extends BaseStateFragment ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS, onFailListener); } + if (!TextUtils.isEmpty(info.getParentChannelAvatarUrl())) { + IMAGE_LOADER.displayImage(info.getParentChannelAvatarUrl(), parentChannelThumb, + ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); + } + if (!TextUtils.isEmpty(info.getUploaderAvatarUrl())) { IMAGE_LOADER.displayImage(info.getUploaderAvatarUrl(), uploaderThumb, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); @@ -964,7 +993,7 @@ public class VideoDetailFragment extends BaseStateFragment @NonNull final StreamInfo info, @NonNull final Stream selectedStream) { NavigationHelper.playOnExternalPlayer(context, currentInfo.getName(), - currentInfo.getUploaderName(), selectedStream); + currentInfo.getParentChannelName(), selectedStream); final HistoryRecordManager recordManager = new HistoryRecordManager(requireContext()); disposables.add(recordManager.onViewed(info).onErrorComplete() @@ -1097,9 +1126,9 @@ public class VideoDetailFragment extends BaseStateFragment } IMAGE_LOADER.cancelDisplayTask(thumbnailImageView); - IMAGE_LOADER.cancelDisplayTask(uploaderThumb); + IMAGE_LOADER.cancelDisplayTask(parentChannelThumb); thumbnailImageView.setImageBitmap(null); - uploaderThumb.setImageBitmap(null); + parentChannelThumb.setImageBitmap(null); } @Override @@ -1127,13 +1156,17 @@ public class VideoDetailFragment extends BaseStateFragment animateView(thumbnailPlayButton, true, 200); videoTitleTextView.setText(name); - if (!TextUtils.isEmpty(info.getUploaderName())) { - uploaderTextView.setText(info.getUploaderName()); - uploaderTextView.setVisibility(View.VISIBLE); - uploaderTextView.setSelected(true); + if (!TextUtils.isEmpty(info.getParentChannelName())) { + displayBothUploaderAndParentChannel(info); + } else if (!TextUtils.isEmpty(info.getUploaderName())) { + displayUploaderAsParentChannel(info); } else { + parentChannelThumb.setVisibility(View.GONE); uploaderTextView.setVisibility(View.GONE); + uploaderThumb.setVisibility(View.GONE); } + + parentChannelThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); if (info.getViewCount() >= 0) { @@ -1264,6 +1297,28 @@ public class VideoDetailFragment extends BaseStateFragment viewPager.setVisibility(View.GONE); tabLayout.setVisibility(View.GONE); } + private void displayUploaderAsParentChannel(final StreamInfo info) { + parentChannelTextView.setText(info.getUploaderName()); + parentChannelTextView.setVisibility(View.VISIBLE); + parentChannelTextView.setSelected(true); + parentChannelThumb.setVisibility(View.GONE); + uploaderTextView.setVisibility(View.GONE); + } + + private void displayBothUploaderAndParentChannel(final StreamInfo info) { + parentChannelTextView.setText(info.getParentChannelName()); + parentChannelTextView.setVisibility(View.VISIBLE); + parentChannelTextView.setSelected(true); + + if (!TextUtils.isEmpty(info.getUploaderName())) { + uploaderTextView.setText("By " + info.getUploaderName()); + uploaderTextView.setVisibility(View.VISIBLE); + uploaderTextView.setSelected(true); + } else { + uploaderTextView.setVisibility(View.GONE); + } + } + public void openDownloadDialog() { try { diff --git a/app/src/main/res/layout-large-land/fragment_video_detail.xml b/app/src/main/res/layout-large-land/fragment_video_detail.xml index 10a622d55..8927a42fc 100644 --- a/app/src/main/res/layout-large-land/fragment_video_detail.xml +++ b/app/src/main/res/layout-large-land/fragment_video_detail.xml @@ -251,28 +251,66 @@ android:focusable="true" android:padding="6dp"> - + - + + + + + + + android:layout_height="match_parent" + android:gravity="center_vertical" + android:orientation="vertical"> + + + + + 42dp + 22dp 20sp 20sp 90dp diff --git a/app/src/main/res/values-sw600dp/dimens.xml b/app/src/main/res/values-sw600dp/dimens.xml index d745cdfb0..e3b7e6df7 100644 --- a/app/src/main/res/values-sw600dp/dimens.xml +++ b/app/src/main/res/values-sw600dp/dimens.xml @@ -8,12 +8,14 @@ 16sp 16sp 14sp - 16sp + 16sp + 12sp 16sp 16sp 18sp 45dp + 25dp 18sp 18sp diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index d97444f5b..575ac4e25 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -54,14 +54,16 @@ 15sp 13sp 12sp - 14sp + 12sp + 14sp 13sp 13sp 15sp - 12sp + 12sp 12sp - 28dp + 32dp + 16dp 18sp 18sp 70dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3b7bc8a4a..003088162 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -651,4 +651,5 @@ Disable fast mode Do you think feed loading is too slow? If so, try enabling fast loading (you can change it in settings or by pressing the button below).\n\nNewPipe offers two feed loading strategies:\n• Fetching the whole subscription channel, which is slow but complete.\n• Using a dedicated service endpoint, which is fast but usually not complete.\n\nThe difference between the two is that the fast one usually lacks some information, like the item\'s duration or type (can\'t distinguish between live videos and normal ones) and it may return less items.\n\nYouTube is an example of a service that offers this fast method with its RSS feed.\n\nSo the choice boils down to what you prefer: speed or precise information. This content is not yet supported by NewPipe.\n\nIt will hopefully be supported in a future version. + Channel\'s avatar thumbnail diff --git a/settings.gradle b/settings.gradle index e7b4def49..4928db65f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,7 @@ include ':app' + +includeBuild('../NewPipeExtractor') { + dependencySubstitution { + substitute module('com.github.TeamNewPipe:NewPipeExtractor') with project(':extractor') + } +} \ No newline at end of file From 2d0bc0548849da36e9ad0c4a5d70025aca89a737 Mon Sep 17 00:00:00 2001 From: Roy Yosef Date: Mon, 13 Apr 2020 23:40:58 +0300 Subject: [PATCH 2/7] Add sub-channel details to channel fragment --- .../list/channel/ChannelFragment.java | 60 +++++++++++++++- .../newpipe/streams/Mp4FromDashWriter.java | 3 +- app/src/main/res/layout/channel_header.xml | 68 +++++++++++++------ 3 files changed, 109 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java index ad8d25d3a..faa13c792 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java @@ -21,6 +21,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; import com.jakewharton.rxbinding2.view.RxView; @@ -38,6 +39,7 @@ import org.schabi.newpipe.fragments.list.BaseListInfoFragment; import org.schabi.newpipe.local.subscription.SubscriptionManager; import org.schabi.newpipe.player.playqueue.ChannelPlayQueue; import org.schabi.newpipe.player.playqueue.PlayQueue; +import org.schabi.newpipe.report.ErrorActivity; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.AnimationUtils; import org.schabi.newpipe.util.ExtractorHelper; @@ -65,7 +67,8 @@ import static org.schabi.newpipe.util.AnimationUtils.animateBackgroundColor; import static org.schabi.newpipe.util.AnimationUtils.animateTextColor; import static org.schabi.newpipe.util.AnimationUtils.animateView; -public class ChannelFragment extends BaseListInfoFragment { +public class ChannelFragment extends BaseListInfoFragment + implements View.OnClickListener { private static final int BUTTON_DEBOUNCE_INTERVAL = 100; private final CompositeDisposable disposables = new CompositeDisposable(); private Disposable subscribeButtonMonitor; @@ -79,6 +82,8 @@ public class ChannelFragment extends BaseListInfoFragment { private ImageView headerChannelBanner; private ImageView headerAvatarView; private TextView headerTitleView; + private ImageView headerParentChannelAvatarView; + private TextView headerParentChannelTitleView; private TextView headerSubscribersTextView; private Button headerSubscribeButton; private View playlistCtrl; @@ -156,7 +161,10 @@ public class ChannelFragment extends BaseListInfoFragment { headerSubscribersTextView = headerRootLayout.findViewById(R.id.channel_subscriber_view); headerSubscribeButton = headerRootLayout.findViewById(R.id.channel_subscribe_button); playlistCtrl = headerRootLayout.findViewById(R.id.playlist_control); - + headerParentChannelAvatarView = + headerRootLayout.findViewById(R.id.parent_channel_avatar_view); + headerParentChannelTitleView = + headerRootLayout.findViewById(R.id.parent_channel_title_view); headerPlayAllButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_all_button); headerPopupButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_popup_button); @@ -165,6 +173,12 @@ public class ChannelFragment extends BaseListInfoFragment { return headerRootLayout; } + @Override + protected void initListeners() { + headerParentChannelTitleView.setOnClickListener(this); + headerParentChannelAvatarView.setOnClickListener(this); + } + /*////////////////////////////////////////////////////////////////////////// // Menu //////////////////////////////////////////////////////////////////////////*/ @@ -394,6 +408,36 @@ public class ChannelFragment extends BaseListInfoFragment { return ExtractorHelper.getChannelInfo(serviceId, url, forceLoad); } + /*////////////////////////////////////////////////////////////////////////// + // OnClick + //////////////////////////////////////////////////////////////////////////*/ + + @Override + public void onClick(final View v) { + if (isLoading.get() || currentInfo == null) { + return; + } + + switch (v.getId()) { + case R.id.parent_channel_avatar_view: + case R.id.parent_channel_title_view: + if (TextUtils.isEmpty(currentInfo.getParentChannelUrl())) { + Log.w(TAG, "Can't open parent's channel because we got no channel URL"); + } else { + try { + NavigationHelper.openChannelFragment( + getFragmentManager(), + currentInfo.getServiceId(), + currentInfo.getParentChannelUrl(), + currentInfo.getParentChannelName()); + } catch (Exception e) { + ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); + } + } + break; + } + } + /*////////////////////////////////////////////////////////////////////////// // Contract //////////////////////////////////////////////////////////////////////////*/ @@ -404,6 +448,7 @@ public class ChannelFragment extends BaseListInfoFragment { IMAGE_LOADER.cancelDisplayTask(headerChannelBanner); IMAGE_LOADER.cancelDisplayTask(headerAvatarView); + IMAGE_LOADER.cancelDisplayTask(headerParentChannelAvatarView); animateView(headerSubscribeButton, false, 100); } @@ -416,6 +461,8 @@ public class ChannelFragment extends BaseListInfoFragment { ImageDisplayConstants.DISPLAY_BANNER_OPTIONS); IMAGE_LOADER.displayImage(result.getAvatarUrl(), headerAvatarView, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); + IMAGE_LOADER.displayImage(result.getParentChannelAvatarUrl(), headerParentChannelAvatarView, + ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); headerSubscribersTextView.setVisibility(View.VISIBLE); if (result.getSubscriberCount() >= 0) { @@ -425,6 +472,15 @@ public class ChannelFragment extends BaseListInfoFragment { headerSubscribersTextView.setText(R.string.subscribers_count_not_available); } + if (!TextUtils.isEmpty(currentInfo.getParentChannelName())) { + headerParentChannelTitleView.setText( + "Created by " + currentInfo.getParentChannelName()); + headerParentChannelTitleView.setVisibility(View.VISIBLE); + } else { + headerParentChannelTitleView.setVisibility(View.GONE); + headerParentChannelAvatarView.setVisibility(View.GONE); + } + if (menuRssButton != null) { menuRssButton.setVisible(!TextUtils.isEmpty(result.getFeedUrl())); } diff --git a/app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java b/app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java index 6f7d27c2c..eb208280e 100644 --- a/app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java +++ b/app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java @@ -711,7 +711,8 @@ public class Mp4FromDashWriter { for (int i = 0; i < tracks.length; i++) { if (tracks[i].trak.tkhd.matrix.length != 36) { - throw new RuntimeException("bad track matrix length (expected 36) in track n°" + i); + throw + new RuntimeException("bad track matrix length (expected 36) in track n°" + i); } makeTrak(i, durations[i], defaultMediaTime[i], tablesInfo[i], is64); } diff --git a/app/src/main/res/layout/channel_header.xml b/app/src/main/res/layout/channel_header.xml index 4a0e261c5..59e22cfb5 100644 --- a/app/src/main/res/layout/channel_header.xml +++ b/app/src/main/res/layout/channel_header.xml @@ -23,17 +23,32 @@ android:src="@drawable/channel_banner" tools:ignore="ContentDescription"/> - + android:layout_marginTop="50dp"> + + + + + + tools:text="Lorem ipsum dolor" /> + + + tools:visibility="visible" /> Date: Thu, 16 Apr 2020 18:35:42 +0300 Subject: [PATCH 3/7] Fix PR review Make all of the uploader section on stream page navigate to the channel page Extract hard coded strings Remove redundant spaces Fix open streams from a channel Rename "ParentChannel" to "SubChannel" Config royosef:NewPipeExtractor in app/build.gradle --- app/build.gradle | 2 +- .../fragments/detail/VideoDetailFragment.java | 82 ++++++++----------- .../list/channel/ChannelFragment.java | 52 ++++++------ .../fragment_video_detail.xml | 6 +- app/src/main/res/layout/channel_header.xml | 6 +- .../main/res/layout/fragment_video_detail.xml | 12 +-- app/src/main/res/values-land/dimens.xml | 4 +- app/src/main/res/values-sw600dp/dimens.xml | 4 +- app/src/main/res/values/dimens.xml | 4 +- app/src/main/res/values/strings.xml | 4 +- settings.gradle | 8 +- 11 files changed, 87 insertions(+), 97 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ecbdc150b..eeda33f50 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -158,7 +158,7 @@ dependencies { exclude module: 'support-annotations' }) - implementation 'com.github.TeamNewPipe:NewPipeExtractor:665c69b5306d335985d5c0692f5119b5172c1b7a' + implementation 'com.github.Royosef:NewPipeExtractor:a4086617719e53b293efa1e8873799ba7714cb14' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.23.0' diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index b6e53e74d..520c23984 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -172,10 +172,11 @@ public class VideoDetailFragment extends BaseStateFragment private TextView videoUploadDateView; private TextView videoDescriptionView; + private View uploaderRootLayout; private TextView uploaderTextView; private ImageView uploaderThumb; - private TextView parentChannelTextView; - private ImageView parentChannelThumb; + private TextView subChannelTextView; + private ImageView subChannelThumb; private TextView thumbsUpTextView; private ImageView thumbsUpImageView; @@ -419,25 +420,16 @@ public class VideoDetailFragment extends BaseStateFragment this.openDownloadDialog(); } break; - case R.id.detail_parent_channel_text_view: - case R.id.detail_parent_channel_thumbnail_view: - if (TextUtils.isEmpty(currentInfo.getParentChannelUrl())) { - Log.w(TAG, "Can't open parent's channel because we got no channel URL"); + case R.id.detail_uploader_root_layout: + if (TextUtils.isEmpty(currentInfo.getSubChannelUrl())) { + Log.w(TAG, "Can't open sub-channel because we got no channel URL"); if (!TextUtils.isEmpty(currentInfo.getUploaderUrl())) { openChannel(currentInfo.getUploaderUrl(), currentInfo.getUploaderName()); } } else { - openChannel(currentInfo.getParentChannelUrl(), - currentInfo.getParentChannelName()); - } - break; - case R.id.detail_uploader_text_view: - case R.id.detail_uploader_thumbnail_view: - if (TextUtils.isEmpty(currentInfo.getUploaderUrl())) { - Log.w(TAG, "Can't open channel because we got no channel URL"); - } else { - openChannel(currentInfo.getUploaderUrl(), currentInfo.getUploaderName()); + openChannel(currentInfo.getSubChannelUrl(), + currentInfo.getSubChannelName()); } break; case R.id.detail_thumbnail_root_layout: @@ -454,13 +446,13 @@ public class VideoDetailFragment extends BaseStateFragment } } - private void openChannel(final String parentChannelUrl, final String parentChannelName) { + private void openChannel(final String subChannelUrl, final String subChannelName) { try { NavigationHelper.openChannelFragment( getFragmentManager(), currentInfo.getServiceId(), - parentChannelUrl, - parentChannelName); + subChannelUrl, + subChannelName); } catch (Exception e) { ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); } @@ -541,10 +533,11 @@ public class VideoDetailFragment extends BaseStateFragment thumbsDownImageView = rootView.findViewById(R.id.detail_thumbs_down_img_view); thumbsDisabledTextView = rootView.findViewById(R.id.detail_thumbs_disabled_view); + uploaderRootLayout = rootView.findViewById(R.id.detail_uploader_root_layout); uploaderTextView = rootView.findViewById(R.id.detail_uploader_text_view); uploaderThumb = rootView.findViewById(R.id.detail_uploader_thumbnail_view); - parentChannelTextView = rootView.findViewById(R.id.detail_parent_channel_text_view); - parentChannelThumb = rootView.findViewById(R.id.detail_parent_channel_thumbnail_view); + subChannelTextView = rootView.findViewById(R.id.detail_sub_channel_text_view); + subChannelThumb = rootView.findViewById(R.id.detail_sub_channel_thumbnail_view); appBarLayout = rootView.findViewById(R.id.appbarlayout); viewPager = rootView.findViewById(R.id.viewpager); @@ -574,11 +567,7 @@ public class VideoDetailFragment extends BaseStateFragment protected void initListeners() { super.initListeners(); - uploaderTextView.setOnClickListener(this); - uploaderThumb.setOnClickListener(this); - parentChannelTextView.setOnClickListener(this); - parentChannelThumb.setOnClickListener(this); - + uploaderRootLayout.setOnClickListener(this); videoTitleRoot.setOnClickListener(this); thumbnailBackgroundButton.setOnClickListener(this); detailControlsBackground.setOnClickListener(this); @@ -627,8 +616,8 @@ public class VideoDetailFragment extends BaseStateFragment ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS, onFailListener); } - if (!TextUtils.isEmpty(info.getParentChannelAvatarUrl())) { - IMAGE_LOADER.displayImage(info.getParentChannelAvatarUrl(), parentChannelThumb, + if (!TextUtils.isEmpty(info.getSubChannelAvatarUrl())) { + IMAGE_LOADER.displayImage(info.getSubChannelAvatarUrl(), subChannelThumb, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); } @@ -993,7 +982,7 @@ public class VideoDetailFragment extends BaseStateFragment @NonNull final StreamInfo info, @NonNull final Stream selectedStream) { NavigationHelper.playOnExternalPlayer(context, currentInfo.getName(), - currentInfo.getParentChannelName(), selectedStream); + currentInfo.getSubChannelName(), selectedStream); final HistoryRecordManager recordManager = new HistoryRecordManager(requireContext()); disposables.add(recordManager.onViewed(info).onErrorComplete() @@ -1126,9 +1115,9 @@ public class VideoDetailFragment extends BaseStateFragment } IMAGE_LOADER.cancelDisplayTask(thumbnailImageView); - IMAGE_LOADER.cancelDisplayTask(parentChannelThumb); + IMAGE_LOADER.cancelDisplayTask(subChannelThumb); thumbnailImageView.setImageBitmap(null); - parentChannelThumb.setImageBitmap(null); + subChannelThumb.setImageBitmap(null); } @Override @@ -1156,17 +1145,17 @@ public class VideoDetailFragment extends BaseStateFragment animateView(thumbnailPlayButton, true, 200); videoTitleTextView.setText(name); - if (!TextUtils.isEmpty(info.getParentChannelName())) { - displayBothUploaderAndParentChannel(info); + if (!TextUtils.isEmpty(info.getSubChannelName())) { + displayBothUploaderAndSubChannel(info); } else if (!TextUtils.isEmpty(info.getUploaderName())) { - displayUploaderAsParentChannel(info); + displayUploaderAsSubChannel(info); } else { - parentChannelThumb.setVisibility(View.GONE); + subChannelThumb.setVisibility(View.GONE); uploaderTextView.setVisibility(View.GONE); uploaderThumb.setVisibility(View.GONE); } - parentChannelThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); + subChannelThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); if (info.getViewCount() >= 0) { @@ -1297,21 +1286,22 @@ public class VideoDetailFragment extends BaseStateFragment viewPager.setVisibility(View.GONE); tabLayout.setVisibility(View.GONE); } - private void displayUploaderAsParentChannel(final StreamInfo info) { - parentChannelTextView.setText(info.getUploaderName()); - parentChannelTextView.setVisibility(View.VISIBLE); - parentChannelTextView.setSelected(true); - parentChannelThumb.setVisibility(View.GONE); + private void displayUploaderAsSubChannel(final StreamInfo info) { + subChannelTextView.setText(info.getUploaderName()); + subChannelTextView.setVisibility(View.VISIBLE); + subChannelTextView.setSelected(true); + subChannelThumb.setVisibility(View.GONE); uploaderTextView.setVisibility(View.GONE); } - private void displayBothUploaderAndParentChannel(final StreamInfo info) { - parentChannelTextView.setText(info.getParentChannelName()); - parentChannelTextView.setVisibility(View.VISIBLE); - parentChannelTextView.setSelected(true); + private void displayBothUploaderAndSubChannel(final StreamInfo info) { + subChannelTextView.setText(info.getSubChannelName()); + subChannelTextView.setVisibility(View.VISIBLE); + subChannelTextView.setSelected(true); if (!TextUtils.isEmpty(info.getUploaderName())) { - uploaderTextView.setText("By " + info.getUploaderName()); + uploaderTextView.setText( + String.format(getString(R.string.video_detail_by), info.getUploaderName())); uploaderTextView.setVisibility(View.VISIBLE); uploaderTextView.setSelected(true); } else { diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java index faa13c792..315660710 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java @@ -82,8 +82,8 @@ public class ChannelFragment extends BaseListInfoFragment private ImageView headerChannelBanner; private ImageView headerAvatarView; private TextView headerTitleView; - private ImageView headerParentChannelAvatarView; - private TextView headerParentChannelTitleView; + private ImageView headerSubChannelAvatarView; + private TextView headerSubChannelTitleView; private TextView headerSubscribersTextView; private Button headerSubscribeButton; private View playlistCtrl; @@ -161,10 +161,10 @@ public class ChannelFragment extends BaseListInfoFragment headerSubscribersTextView = headerRootLayout.findViewById(R.id.channel_subscriber_view); headerSubscribeButton = headerRootLayout.findViewById(R.id.channel_subscribe_button); playlistCtrl = headerRootLayout.findViewById(R.id.playlist_control); - headerParentChannelAvatarView = - headerRootLayout.findViewById(R.id.parent_channel_avatar_view); - headerParentChannelTitleView = - headerRootLayout.findViewById(R.id.parent_channel_title_view); + headerSubChannelAvatarView = + headerRootLayout.findViewById(R.id.sub_channel_avatar_view); + headerSubChannelTitleView = + headerRootLayout.findViewById(R.id.sub_channel_title_view); headerPlayAllButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_all_button); headerPopupButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_popup_button); @@ -175,8 +175,10 @@ public class ChannelFragment extends BaseListInfoFragment @Override protected void initListeners() { - headerParentChannelTitleView.setOnClickListener(this); - headerParentChannelAvatarView.setOnClickListener(this); + super.initListeners(); + + headerSubChannelTitleView.setOnClickListener(this); + headerSubChannelAvatarView.setOnClickListener(this); } /*////////////////////////////////////////////////////////////////////////// @@ -408,28 +410,28 @@ public class ChannelFragment extends BaseListInfoFragment return ExtractorHelper.getChannelInfo(serviceId, url, forceLoad); } - /*////////////////////////////////////////////////////////////////////////// + /*////////////////////////////////////////////////////////////////////////// // OnClick //////////////////////////////////////////////////////////////////////////*/ - @Override + @Override public void onClick(final View v) { if (isLoading.get() || currentInfo == null) { return; } switch (v.getId()) { - case R.id.parent_channel_avatar_view: - case R.id.parent_channel_title_view: - if (TextUtils.isEmpty(currentInfo.getParentChannelUrl())) { - Log.w(TAG, "Can't open parent's channel because we got no channel URL"); + case R.id.sub_channel_avatar_view: + case R.id.sub_channel_title_view: + if (TextUtils.isEmpty(currentInfo.getSubChannelUrl())) { + Log.w(TAG, "Can't open sub-channel because we got no channel URL"); } else { try { NavigationHelper.openChannelFragment( getFragmentManager(), currentInfo.getServiceId(), - currentInfo.getParentChannelUrl(), - currentInfo.getParentChannelName()); + currentInfo.getSubChannelUrl(), + currentInfo.getSubChannelName()); } catch (Exception e) { ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); } @@ -448,7 +450,7 @@ public class ChannelFragment extends BaseListInfoFragment IMAGE_LOADER.cancelDisplayTask(headerChannelBanner); IMAGE_LOADER.cancelDisplayTask(headerAvatarView); - IMAGE_LOADER.cancelDisplayTask(headerParentChannelAvatarView); + IMAGE_LOADER.cancelDisplayTask(headerSubChannelAvatarView); animateView(headerSubscribeButton, false, 100); } @@ -461,7 +463,7 @@ public class ChannelFragment extends BaseListInfoFragment ImageDisplayConstants.DISPLAY_BANNER_OPTIONS); IMAGE_LOADER.displayImage(result.getAvatarUrl(), headerAvatarView, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); - IMAGE_LOADER.displayImage(result.getParentChannelAvatarUrl(), headerParentChannelAvatarView, + IMAGE_LOADER.displayImage(result.getSubChannelAvatarUrl(), headerSubChannelAvatarView, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); headerSubscribersTextView.setVisibility(View.VISIBLE); @@ -472,13 +474,15 @@ public class ChannelFragment extends BaseListInfoFragment headerSubscribersTextView.setText(R.string.subscribers_count_not_available); } - if (!TextUtils.isEmpty(currentInfo.getParentChannelName())) { - headerParentChannelTitleView.setText( - "Created by " + currentInfo.getParentChannelName()); - headerParentChannelTitleView.setVisibility(View.VISIBLE); + if (!TextUtils.isEmpty(currentInfo.getSubChannelName())) { + headerSubChannelTitleView.setText(String.format( + getString(R.string.channel_created_by), + currentInfo.getSubChannelName()) + ); + headerSubChannelTitleView.setVisibility(View.VISIBLE); } else { - headerParentChannelTitleView.setVisibility(View.GONE); - headerParentChannelAvatarView.setVisibility(View.GONE); + headerSubChannelTitleView.setVisibility(View.GONE); + headerSubChannelAvatarView.setVisibility(View.GONE); } if (menuRssButton != null) { diff --git a/app/src/main/res/layout-large-land/fragment_video_detail.xml b/app/src/main/res/layout-large-land/fragment_video_detail.xml index 8927a42fc..73fe539b1 100644 --- a/app/src/main/res/layout-large-land/fragment_video_detail.xml +++ b/app/src/main/res/layout-large-land/fragment_video_detail.xml @@ -264,7 +264,7 @@ android:src="@drawable/buddy" /> diff --git a/app/src/main/res/layout/channel_header.xml b/app/src/main/res/layout/channel_header.xml index 59e22cfb5..4d2e08c2a 100644 --- a/app/src/main/res/layout/channel_header.xml +++ b/app/src/main/res/layout/channel_header.xml @@ -40,7 +40,7 @@ tools:ignore="RtlHardcoded" /> @@ -276,7 +276,7 @@ android:orientation="vertical"> diff --git a/app/src/main/res/values-land/dimens.xml b/app/src/main/res/values-land/dimens.xml index 18de966c6..c8be15b50 100644 --- a/app/src/main/res/values-land/dimens.xml +++ b/app/src/main/res/values-land/dimens.xml @@ -26,7 +26,7 @@ 14sp 13sp 12sp - 16sp + 16sp 14sp 14sp 17sp @@ -34,7 +34,7 @@ 14sp 42dp - 22dp + 22dp 20sp 20sp 90dp diff --git a/app/src/main/res/values-sw600dp/dimens.xml b/app/src/main/res/values-sw600dp/dimens.xml index e3b7e6df7..7c781fec1 100644 --- a/app/src/main/res/values-sw600dp/dimens.xml +++ b/app/src/main/res/values-sw600dp/dimens.xml @@ -8,14 +8,14 @@ 16sp 16sp 14sp - 16sp + 16sp 12sp 16sp 16sp 18sp 45dp - 25dp + 25dp 18sp 18sp diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 575ac4e25..b7ab33b1a 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -55,7 +55,7 @@ 13sp 12sp 12sp - 14sp + 14sp 13sp 13sp 15sp @@ -63,7 +63,7 @@ 12sp 32dp - 16dp + 16dp 18sp 18sp 70dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 003088162..bfd848d10 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -651,5 +651,7 @@ Disable fast mode Do you think feed loading is too slow? If so, try enabling fast loading (you can change it in settings or by pressing the button below).\n\nNewPipe offers two feed loading strategies:\n• Fetching the whole subscription channel, which is slow but complete.\n• Using a dedicated service endpoint, which is fast but usually not complete.\n\nThe difference between the two is that the fast one usually lacks some information, like the item\'s duration or type (can\'t distinguish between live videos and normal ones) and it may return less items.\n\nYouTube is an example of a service that offers this fast method with its RSS feed.\n\nSo the choice boils down to what you prefer: speed or precise information. This content is not yet supported by NewPipe.\n\nIt will hopefully be supported in a future version. - Channel\'s avatar thumbnail + Channel\'s avatar thumbnail + Created by %s + By %s diff --git a/settings.gradle b/settings.gradle index 4928db65f..9d495b34f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1 @@ -include ':app' - -includeBuild('../NewPipeExtractor') { - dependencySubstitution { - substitute module('com.github.TeamNewPipe:NewPipeExtractor') with project(':extractor') - } -} \ No newline at end of file +include ':app' \ No newline at end of file From b7d4a4f604772c722634d85c516657d014e89e30 Mon Sep 17 00:00:00 2001 From: Roy Yosef Date: Mon, 20 Apr 2020 00:01:02 +0300 Subject: [PATCH 4/7] Navigate to parent(uploader) channel from the uploader section on long click --- .../newpipe/fragments/detail/VideoDetailFragment.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 520c23984..b49bb6a90 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -474,6 +474,15 @@ public class VideoDetailFragment extends BaseStateFragment case R.id.detail_controls_download: NavigationHelper.openDownloads(getActivity()); break; + + case R.id.detail_uploader_root_layout: + if (TextUtils.isEmpty(currentInfo.getSubChannelUrl())) { + Log.w(TAG, + "Can't open parent channel because we got no parent channel URL"); + } else { + openChannel(currentInfo.getUploaderUrl(), currentInfo.getUploaderName()); + } + break; } return true; @@ -568,6 +577,7 @@ public class VideoDetailFragment extends BaseStateFragment super.initListeners(); uploaderRootLayout.setOnClickListener(this); + uploaderRootLayout.setOnLongClickListener(this); videoTitleRoot.setOnClickListener(this); thumbnailBackgroundButton.setOnClickListener(this); detailControlsBackground.setOnClickListener(this); From 235394d96cbe167be17be32b072226ae45e055ea Mon Sep 17 00:00:00 2001 From: wb9688 Date: Thu, 7 May 2020 20:51:54 +0200 Subject: [PATCH 5/7] Don't show sub-channel thumbnail by default --- .../fragments/detail/VideoDetailFragment.java | 5 +- .../list/channel/ChannelFragment.java | 2 +- .../fragment_video_detail.xml | 1019 +++++++++-------- app/src/main/res/layout/channel_header.xml | 18 +- .../main/res/layout/fragment_video_detail.xml | 1011 ++++++++-------- 5 files changed, 1029 insertions(+), 1026 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index b49bb6a90..e65da09fb 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -1160,7 +1160,6 @@ public class VideoDetailFragment extends BaseStateFragment } else if (!TextUtils.isEmpty(info.getUploaderName())) { displayUploaderAsSubChannel(info); } else { - subChannelThumb.setVisibility(View.GONE); uploaderTextView.setVisibility(View.GONE); uploaderThumb.setVisibility(View.GONE); } @@ -1296,11 +1295,11 @@ public class VideoDetailFragment extends BaseStateFragment viewPager.setVisibility(View.GONE); tabLayout.setVisibility(View.GONE); } + private void displayUploaderAsSubChannel(final StreamInfo info) { subChannelTextView.setText(info.getUploaderName()); subChannelTextView.setVisibility(View.VISIBLE); subChannelTextView.setSelected(true); - subChannelThumb.setVisibility(View.GONE); uploaderTextView.setVisibility(View.GONE); } @@ -1309,6 +1308,8 @@ public class VideoDetailFragment extends BaseStateFragment subChannelTextView.setVisibility(View.VISIBLE); subChannelTextView.setSelected(true); + subChannelThumb.setVisibility(View.VISIBLE); + if (!TextUtils.isEmpty(info.getUploaderName())) { uploaderTextView.setText( String.format(getString(R.string.video_detail_by), info.getUploaderName())); diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java index 315660710..eccedd0ed 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java @@ -480,9 +480,9 @@ public class ChannelFragment extends BaseListInfoFragment currentInfo.getSubChannelName()) ); headerSubChannelTitleView.setVisibility(View.VISIBLE); + headerSubChannelAvatarView.setVisibility(View.VISIBLE); } else { headerSubChannelTitleView.setVisibility(View.GONE); - headerSubChannelAvatarView.setVisibility(View.GONE); } if (menuRssButton != null) { diff --git a/app/src/main/res/layout-large-land/fragment_video_detail.xml b/app/src/main/res/layout-large-land/fragment_video_detail.xml index 73fe539b1..b119bf761 100644 --- a/app/src/main/res/layout-large-land/fragment_video_detail.xml +++ b/app/src/main/res/layout-large-land/fragment_video_detail.xml @@ -1,318 +1,319 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/video_item_detail" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:baselineAligned="false" + android:focusableInTouchMode="true" + android:orientation="horizontal" + tools:ignore="RtlHardcoded"> - + - + - + - - + + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - - + + - - + - - + + - + - + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - + - + - + diff --git a/app/src/main/res/layout/channel_header.xml b/app/src/main/res/layout/channel_header.xml index 4d2e08c2a..1f63a62ec 100644 --- a/app/src/main/res/layout/channel_header.xml +++ b/app/src/main/res/layout/channel_header.xml @@ -1,6 +1,5 @@ - + tools:ignore="ContentDescription" /> + app:civ_border_width="2dp" /> + tools:ignore="RtlHardcoded" + tools:visibility="visible" /> + tools:visibility="visible" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/fragment_video_detail.xml b/app/src/main/res/layout/fragment_video_detail.xml index 487bf1e9d..dfe6435f7 100644 --- a/app/src/main/res/layout/fragment_video_detail.xml +++ b/app/src/main/res/layout/fragment_video_detail.xml @@ -1,566 +1,567 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/video_item_detail" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:focusableInTouchMode="true"> - + - + - + - - + + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - + From 1096ec1c099a4b8999616d07b8a174d27ed3c9af Mon Sep 17 00:00:00 2001 From: wb9688 Date: Fri, 8 May 2020 09:18:56 +0200 Subject: [PATCH 6/7] Adjust sub-channel thumbnail size --- app/src/main/res/layout/channel_header.xml | 4 ++-- app/src/main/res/values-land/dimens.xml | 5 +++-- app/src/main/res/values-sw600dp-land/dimens.xml | 2 +- app/src/main/res/values-sw600dp/dimens.xml | 6 +++--- app/src/main/res/values/dimens.xml | 1 + 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/layout/channel_header.xml b/app/src/main/res/layout/channel_header.xml index 1f63a62ec..0554db48e 100644 --- a/app/src/main/res/layout/channel_header.xml +++ b/app/src/main/res/layout/channel_header.xml @@ -39,8 +39,8 @@ 14sp 42dp - 22dp + 21dp 20sp 20sp 90dp + 45dp 8dp 4dp @@ -50,4 +51,4 @@ 16sp - \ No newline at end of file + diff --git a/app/src/main/res/values-sw600dp-land/dimens.xml b/app/src/main/res/values-sw600dp-land/dimens.xml index 321ee69cc..b578744d7 100644 --- a/app/src/main/res/values-sw600dp-land/dimens.xml +++ b/app/src/main/res/values-sw600dp-land/dimens.xml @@ -18,4 +18,4 @@ 4dp - \ No newline at end of file + diff --git a/app/src/main/res/values-sw600dp/dimens.xml b/app/src/main/res/values-sw600dp/dimens.xml index 7c781fec1..15b6d214e 100644 --- a/app/src/main/res/values-sw600dp/dimens.xml +++ b/app/src/main/res/values-sw600dp/dimens.xml @@ -14,11 +14,11 @@ 16sp 18sp - 45dp - 25dp + 40dp + 20dp 18sp 18sp 10dp - \ No newline at end of file + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index b7ab33b1a..5f58f4c90 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -67,6 +67,7 @@ 18sp 18sp 70dp + 35dp 5dp 50dp From ae437b1510e7b83b2d40df8704192c4e3e57a200 Mon Sep 17 00:00:00 2001 From: wb9688 Date: Fri, 8 May 2020 18:03:19 +0200 Subject: [PATCH 7/7] Bump NewPipeExtractor --- app/build.gradle | 2 +- .../fragments/detail/VideoDetailFragment.java | 6 ++++-- .../list/channel/ChannelFragment.java | 20 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index eeda33f50..64b73d77b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -158,7 +158,7 @@ dependencies { exclude module: 'support-annotations' }) - implementation 'com.github.Royosef:NewPipeExtractor:a4086617719e53b293efa1e8873799ba7714cb14' + implementation 'com.github.TeamNewPipe:NewPipeExtractor:f3913e241e379adf0091319091e8f895c5fcfd07' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.23.0' diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index e65da09fb..b0da6ac29 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -422,11 +422,13 @@ public class VideoDetailFragment extends BaseStateFragment break; case R.id.detail_uploader_root_layout: if (TextUtils.isEmpty(currentInfo.getSubChannelUrl())) { - Log.w(TAG, "Can't open sub-channel because we got no channel URL"); - if (!TextUtils.isEmpty(currentInfo.getUploaderUrl())) { openChannel(currentInfo.getUploaderUrl(), currentInfo.getUploaderName()); } + + if (DEBUG) { + Log.i(TAG, "Can't open sub-channel because we got no channel URL"); + } } else { openChannel(currentInfo.getSubChannelUrl(), currentInfo.getSubChannelName()); diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java index eccedd0ed..a9b703b14 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java @@ -423,18 +423,16 @@ public class ChannelFragment extends BaseListInfoFragment switch (v.getId()) { case R.id.sub_channel_avatar_view: case R.id.sub_channel_title_view: - if (TextUtils.isEmpty(currentInfo.getSubChannelUrl())) { - Log.w(TAG, "Can't open sub-channel because we got no channel URL"); - } else { + if (!TextUtils.isEmpty(currentInfo.getParentChannelUrl())) { try { - NavigationHelper.openChannelFragment( - getFragmentManager(), - currentInfo.getServiceId(), - currentInfo.getSubChannelUrl(), - currentInfo.getSubChannelName()); + NavigationHelper.openChannelFragment(getFragmentManager(), + currentInfo.getServiceId(), currentInfo.getParentChannelUrl(), + currentInfo.getParentChannelName()); } catch (Exception e) { ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); } + } else if (DEBUG) { + Log.i(TAG, "Can't open parent channel because we got no channel URL"); } break; } @@ -463,7 +461,7 @@ public class ChannelFragment extends BaseListInfoFragment ImageDisplayConstants.DISPLAY_BANNER_OPTIONS); IMAGE_LOADER.displayImage(result.getAvatarUrl(), headerAvatarView, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); - IMAGE_LOADER.displayImage(result.getSubChannelAvatarUrl(), headerSubChannelAvatarView, + IMAGE_LOADER.displayImage(result.getParentChannelAvatarUrl(), headerSubChannelAvatarView, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); headerSubscribersTextView.setVisibility(View.VISIBLE); @@ -474,10 +472,10 @@ public class ChannelFragment extends BaseListInfoFragment headerSubscribersTextView.setText(R.string.subscribers_count_not_available); } - if (!TextUtils.isEmpty(currentInfo.getSubChannelName())) { + if (!TextUtils.isEmpty(currentInfo.getParentChannelName())) { headerSubChannelTitleView.setText(String.format( getString(R.string.channel_created_by), - currentInfo.getSubChannelName()) + currentInfo.getParentChannelName()) ); headerSubChannelTitleView.setVisibility(View.VISIBLE); headerSubChannelAvatarView.setVisibility(View.VISIBLE);