Skip to content

Commit

Permalink
Merge pull request TeamNewPipe/NewPipe#5963 from sauravrao637/IssueFi…
Browse files Browse the repository at this point in the history
…x#5959

Fix display of channel details when it has no videos
  • Loading branch information
XiangRongLin authored and tossj committed Apr 23, 2021
1 parent e0d445d commit 5076f32
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.ListInfo;
import org.schabi.newpipe.extractor.Page;
import org.schabi.newpipe.extractor.channel.ChannelInfo;
import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException;
import org.schabi.newpipelegacy.util.Constants;
import org.schabi.newpipelegacy.views.NewPipeRecyclerView;
Expand Down Expand Up @@ -228,7 +229,11 @@ public void handleResult(@NonNull final I result) {
showListFooter(hasMoreItems());
} else {
infoListAdapter.clearStreamItemList();
showEmptyState();
// showEmptyState should be called only if there is no item as
// well as no header in infoListAdapter
if (!(result instanceof ChannelInfo && infoListAdapter.getItemCount() == 1)) {
showEmptyState();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ public void handleResult(@NonNull final ChannelInfo result) {

if (!TextUtils.isEmpty(currentInfo.getParentChannelName())) {
headerBinding.subChannelTitleView.setText(String.format(
getString(R.string.channel_created_by),
currentInfo.getParentChannelName())
getString(R.string.channel_created_by),
currentInfo.getParentChannelName())
);
headerBinding.subChannelTitleView.setVisibility(View.VISIBLE);
headerBinding.subChannelAvatarView.setVisibility(View.VISIBLE);
Expand All @@ -462,7 +462,13 @@ public void handleResult(@NonNull final ChannelInfo result) {
menuRssButton.setVisible(!TextUtils.isEmpty(result.getFeedUrl()));
}

playlistControlBinding.getRoot().setVisibility(View.VISIBLE);
// PlaylistControls should be visible only if there is some item in
// infoListAdapter other than header
if (infoListAdapter.getItemCount() != 1) {
playlistControlBinding.getRoot().setVisibility(View.VISIBLE);
} else {
playlistControlBinding.getRoot().setVisibility(View.GONE);
}

for (final Throwable throwable : result.getErrors()) {
if (throwable instanceof ContentNotSupportedException) {
Expand Down

0 comments on commit 5076f32

Please sign in to comment.