mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
fix: limited the number of items to load
This commit is contained in:
parent
5a2d74a2f4
commit
ff1fb78d4a
5 changed files with 25 additions and 8 deletions
|
|
@ -62,6 +62,16 @@ public class PodcastEpisodeAdapter extends RecyclerView.Adapter<PodcastEpisodeAd
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
ItemHomePodcastEpisodeBinding item;
|
ItemHomePodcastEpisodeBinding item;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ import com.cappielloantonio.play.util.UIUtil;
|
||||||
import com.cappielloantonio.play.viewmodel.PodcastViewModel;
|
import com.cappielloantonio.play.viewmodel.PodcastViewModel;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public class HomeTabPodcastFragment extends Fragment implements ClickCallback {
|
public class HomeTabPodcastFragment extends Fragment implements ClickCallback {
|
||||||
private static final String TAG = "HomeTabPodcastFragment";
|
private static final String TAG = "HomeTabPodcastFragment";
|
||||||
|
|
@ -125,7 +128,7 @@ public class HomeTabPodcastFragment extends Fragment implements ClickCallback {
|
||||||
if (bind != null)
|
if (bind != null)
|
||||||
bind.homeNewestPodcastsSector.setVisibility(!podcastEpisodes.isEmpty() ? View.VISIBLE : View.GONE);
|
bind.homeNewestPodcastsSector.setVisibility(!podcastEpisodes.isEmpty() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
podcastEpisodeAdapter.setItems(podcastEpisodes);
|
podcastEpisodeAdapter.setItems(podcastEpisodes.stream().filter(podcastEpisode -> Objects.equals(podcastEpisode.getStatus(), "completed")).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ import com.cappielloantonio.play.util.UIUtil;
|
||||||
import com.cappielloantonio.play.viewmodel.PodcastChannelPageViewModel;
|
import com.cappielloantonio.play.viewmodel.PodcastChannelPageViewModel;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public class PodcastChannelPageFragment extends Fragment implements ClickCallback {
|
public class PodcastChannelPageFragment extends Fragment implements ClickCallback {
|
||||||
private FragmentPodcastChannelPageBinding bind;
|
private FragmentPodcastChannelPageBinding bind;
|
||||||
|
|
@ -121,9 +124,8 @@ public class PodcastChannelPageFragment extends Fragment implements ClickCallbac
|
||||||
bind.podcastChannelPageEpisodesPlaceholder.placeholder.setVisibility(View.GONE);
|
bind.podcastChannelPageEpisodesPlaceholder.placeholder.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (channels.get(0) != null && channels.get(0).getEpisodes() != null) {
|
if (channels.get(0) != null && channels.get(0).getEpisodes() != null) {
|
||||||
if (bind != null)
|
if (bind != null) bind.podcastChannelPageEpisodesSector.setVisibility(!channels.get(0).getEpisodes().isEmpty() ? View.VISIBLE : View.GONE);
|
||||||
bind.podcastChannelPageEpisodesSector.setVisibility(!channels.get(0).getEpisodes().isEmpty() ? View.VISIBLE : View.GONE);
|
podcastEpisodeAdapter.setItems(channels.get(0).getEpisodes().stream().filter(podcastEpisode -> Objects.equals(podcastEpisode.getStatus(), "completed")).collect(Collectors.toList()));
|
||||||
podcastEpisodeAdapter.setItems(channels.get(0).getEpisodes());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
@ -51,6 +50,7 @@
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
android:nestedScrollingEnabled="false"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingBottom="8dp" />
|
android:paddingBottom="8dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -71,8 +71,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:paddingStart="16dp"
|
android:paddingStart="16dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
android:paddingEnd="16dp"
|
android:paddingEnd="16dp"
|
||||||
android:text="@string/home_title_newest_podcasts" />
|
android:text="@string/home_title_newest_podcasts" />
|
||||||
|
|
||||||
|
|
@ -83,6 +83,7 @@
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
android:nestedScrollingEnabled="false"
|
||||||
android:paddingTop="8dp" />
|
android:paddingTop="8dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
android:id="@+id/collapsing_toolbar"
|
android:id="@+id/collapsing_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:expandedTitleMarginStart="@dimen/activity_margin_content"
|
|
||||||
app:contentScrim="?attr/colorSurface"
|
app:contentScrim="?attr/colorSurface"
|
||||||
|
app:expandedTitleMarginStart="@dimen/activity_margin_content"
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
|
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
@ -114,6 +114,7 @@
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
android:nestedScrollingEnabled="false"
|
||||||
android:paddingTop="8dp" />
|
android:paddingTop="8dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue