diff --git a/app/src/main/java/org/schabi/newpipe/ChannelActivity.java b/app/src/main/java/org/schabi/newpipe/ChannelActivity.java index 1a915633a..37ef28a13 100644 --- a/app/src/main/java/org/schabi/newpipe/ChannelActivity.java +++ b/app/src/main/java/org/schabi/newpipe/ChannelActivity.java @@ -95,6 +95,8 @@ public class ChannelActivity extends AppCompatActivity { recyclerView.setLayoutManager(layoutManager); header = getLayoutInflater().inflate(R.layout.channel_header, recyclerView, false); infoListAdapter.setHeader(header); + infoListAdapter.setFooter( + getLayoutInflater().inflate(R.layout.pignate_footer, recyclerView, false)); recyclerView.setAdapter(infoListAdapter); infoListAdapter.setOnStreamInfoItemSelectedListener( new InfoItemBuilder.OnInfoItemSelectedListener() { @@ -236,16 +238,17 @@ public class ChannelActivity extends AppCompatActivity { //delete already displayed content progressBar.setVisibility(View.VISIBLE); infoListAdapter.clearSteamItemList(); + pageNumber = 0; + subscriberLayout.setVisibility(View.GONE); + titleView.setText(""); + getSupportActionBar().setTitle(""); if (SDK_INT >= 21) { channelBanner.setImageDrawable(getDrawable(R.drawable.channel_banner)); avatarView.setImageDrawable(getDrawable(R.drawable.buddy)); - subscriberLayout.setVisibility(View.GONE); - titleView.setText(""); - getSupportActionBar().setTitle(""); } + infoListAdapter.showFooter(false); } - Thread channelExtractorThread = new Thread(new Runnable() { Handler h = new Handler(); @@ -266,8 +269,12 @@ public class ChannelActivity extends AppCompatActivity { isLoading = false; if(!onlyVideos) { updateUi(info); + infoListAdapter.showFooter(true); } hasNextPage = info.hasNextPage; + if(!hasNextPage) { + infoListAdapter.showFooter(false); + } addVideos(info); } }); diff --git a/app/src/main/java/org/schabi/newpipe/info_list/InfoListAdapter.java b/app/src/main/java/org/schabi/newpipe/info_list/InfoListAdapter.java index 81d28f753..d6f173350 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/InfoListAdapter.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/InfoListAdapter.java @@ -38,16 +38,23 @@ public class InfoListAdapter extends RecyclerView.Adapter infoItemList; + private boolean showFooter = false; private View header = null; + private View footer = null; - public class HeaderHolder extends RecyclerView.ViewHolder { - public HeaderHolder(View v) { + public class HFHolder extends RecyclerView.ViewHolder { + public HFHolder(View v) { super(v); view = v; } public View view; } + public void showFooter(boolean show) { + showFooter = show; + notifyDataSetChanged(); + } + public InfoListAdapter(Activity a, View rootView) { infoItemBuilder = new InfoItemBuilder(a, rootView); infoItemList = new Vector<>(); @@ -63,9 +70,9 @@ public class InfoListAdapter extends RecyclerView.Adapter videos) { - if(videos!= null) { - infoItemList.addAll(videos); + public void addInfoItemList(List data) { + if(data != null) { + infoItemList.addAll(data); notifyDataSetChanged(); } } @@ -77,11 +84,20 @@ public class InfoListAdapter extends RecyclerView.Adapter + + + + + \ No newline at end of file