use of com.owncloud.android.ui.adapter.ActivityAndVersionListAdapter in project android by nextcloud.
the class FileDetailActivitiesFragment method setupView.
private void setupView() {
FileDataStorageManager storageManager = new FileDataStorageManager(user, contentResolver);
operationsHelper = ((ComponentsGetter) requireActivity()).getFileOperationsHelper();
OCCapability capability = storageManager.getCapability(user.getAccountName());
restoreFileVersionSupported = capability.getFilesVersioning().isTrue();
binding.emptyList.emptyListIcon.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_activity, null));
binding.emptyList.emptyListView.setVisibility(View.GONE);
adapter = new ActivityAndVersionListAdapter(getContext(), accountManager, this, this, clientFactory);
binding.list.setAdapter(adapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
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
fetchAndSetData(lastGiven);
}
}
});
}
Aggregations