use of com.odysee.app.adapter.SuggestedChannelGridAdapter in project odysee-android by OdyseeTeam.
the class FollowingFragment method fetchSuggestedChannels.
private void fetchSuggestedChannels() {
if (suggestedClaimSearchLoading) {
return;
}
suggestedClaimSearchLoading = true;
if (discoverDialog != null) {
discoverDialog.setLoading(true);
}
Helper.setViewVisibility(noContentView, View.GONE);
suggestedChannelClaimSearchTask = new ClaimSearchTask(buildSuggestedOptions(), Lbry.API_CONNECTION_STRING, suggestedChannelAdapter == null || suggestedChannelAdapter.getItemCount() == 0 ? bigContentLoading : contentLoading, new ClaimSearchResultHandler() {
@Override
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
suggestedHasReachedEnd = hasReachedEnd;
suggestedClaimSearchLoading = false;
if (discoverDialog != null) {
discoverDialog.setLoading(false);
}
if (suggestedChannelAdapter == null) {
suggestedChannelAdapter = new SuggestedChannelGridAdapter(claims, getContext());
suggestedChannelAdapter.setListener(FollowingFragment.this);
if (suggestedChannelGrid != null) {
suggestedChannelGrid.setAdapter(suggestedChannelAdapter);
}
if (discoverDialog != null) {
discoverDialog.setAdapter(suggestedChannelAdapter);
}
} else {
suggestedChannelAdapter.addClaims(claims);
}
if (discoverDialog == null || !discoverDialog.isVisible()) {
checkNoContent(true);
}
}
@Override
public void onError(Exception error) {
suggestedClaimSearchLoading = false;
if (discoverDialog != null) {
discoverDialog.setLoading(false);
}
if (discoverDialog == null || !discoverDialog.isVisible()) {
checkNoContent(true);
}
}
});
suggestedChannelClaimSearchTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Aggregations