use of com.owncloud.android.ui.adapter.ActivityListAdapter in project android by nextcloud.
the class ActivitiesActivity method setupContent.
/**
* sets up the UI elements and loads all activity items.
*/
private void setupContent() {
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_activity);
adapter = new ActivityListAdapter(this, getUserAccountManager(), this, clientFactory, false, themeColorUtils, themeDrawableUtils);
binding.list.setAdapter(adapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
binding.list.setLayoutManager(layoutManager);
binding.list.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int visibleItemCount = recyclerView.getChildCount();
int totalItemCount = layoutManager.getItemCount();
int firstVisibleItemIndex = layoutManager.findFirstVisibleItemPosition();
// synchronize loading state when item count changes
if (!isLoadingActivities && (totalItemCount - visibleItemCount) <= (firstVisibleItemIndex + 5) && lastGiven > 0) {
// Almost reached the end, continue to load new activities
actionListener.loadActivities(lastGiven);
}
}
});
actionListener.loadActivities(ActivitiesContract.ActionListener.UNDEFINED);
}
use of com.owncloud.android.ui.adapter.ActivityListAdapter in project android by nextcloud.
the class ActivitiesListActivity method setupContent.
/**
* sets up the UI elements and loads all activity items.
*/
private void setupContent() {
emptyContentIcon.setImageResource(R.drawable.ic_activity_light_grey);
emptyContentProgressBar.getIndeterminateDrawable().setColorFilter(ThemeUtils.primaryAccentColor(), PorterDuff.Mode.SRC_IN);
setLoadingMessage();
FileDataStorageManager storageManager = new FileDataStorageManager(getAccount(), getContentResolver());
adapter = new ActivityListAdapter(this, this, storageManager);
recyclerView.setAdapter(adapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int visibleItemCount = recyclerView.getChildCount();
int totalItemCount = layoutManager.getItemCount();
int firstVisibleItemIndex = layoutManager.findFirstVisibleItemPosition();
// synchronize loading state when item count changes
if (!isLoadingActivities && (totalItemCount - visibleItemCount) <= (firstVisibleItemIndex + 5) && nextPageUrl != null && !nextPageUrl.isEmpty()) {
// Almost reached the end, continue to load new activities
fetchAndSetData(nextPageUrl);
}
}
});
if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
bottomNavigationView.setVisibility(View.VISIBLE);
DisplayUtils.setupBottomBar(bottomNavigationView, getResources(), this, -1);
}
fetchAndSetData(null);
}
Aggregations