use of de.danoeh.antennapod.adapter.FeedDiscoverAdapter in project AntennaPod by AntennaPod.
the class QuickFeedDiscoveryFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View root = inflater.inflate(R.layout.quick_feed_discovery, container, false);
View discoverMore = root.findViewById(R.id.discover_more);
discoverMore.setOnClickListener(v -> ((MainActivity) getActivity()).loadChildFragment(new DiscoveryFragment()));
discoverGridLayout = root.findViewById(R.id.discover_grid);
progressBar = root.findViewById(R.id.discover_progress_bar);
errorView = root.findViewById(R.id.discover_error);
errorTextView = root.findViewById(R.id.discover_error_txtV);
errorRetry = root.findViewById(R.id.discover_error_retry_btn);
errorRetry.setOnClickListener((listener) -> loadToplist());
poweredByTextView = root.findViewById(R.id.discover_powered_by_itunes);
adapter = new FeedDiscoverAdapter((MainActivity) getActivity());
discoverGridLayout.setAdapter(adapter);
discoverGridLayout.setOnItemClickListener(this);
DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
float screenWidthDp = displayMetrics.widthPixels / displayMetrics.density;
if (screenWidthDp > 600) {
discoverGridLayout.setNumColumns(6);
} else {
discoverGridLayout.setNumColumns(4);
}
// Fill with dummy elements to have a fixed height and
// prevent the UI elements below from jumping on slow connections
List<PodcastSearchResult> dummies = new ArrayList<>();
for (int i = 0; i < NUM_SUGGESTIONS; i++) {
dummies.add(PodcastSearchResult.dummy());
}
adapter.updateData(dummies);
loadToplist();
EventBus.getDefault().register(this);
return root;
}
Aggregations