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