use of eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager in project talk-android by nextcloud.
the class CallsListController method prepareViews.
private void prepareViews() {
SmoothScrollLinearLayoutManager layoutManager = new SmoothScrollLinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), layoutManager.getOrientation()));
swipeRefreshLayout.setOnRefreshListener(() -> fetchData(false));
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
fastScroller.addOnScrollStateChangeListener(this);
adapter.setFastScroller(fastScroller);
fastScroller.setBubbleTextCreator(position -> {
String displayName = adapter.getItem(position).getModel().getDisplayName();
if (displayName.length() > 8) {
displayName = displayName.substring(0, 4) + "...";
}
return displayName;
});
}
use of eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager in project talk-android by nextcloud.
the class SwitchAccountController method prepareViews.
private void prepareViews() {
LinearLayoutManager layoutManager = new SmoothScrollLinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), layoutManager.getOrientation()));
swipeRefreshLayout.setEnabled(false);
}
use of eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager in project talk-android by nextcloud.
the class CallMenuController method prepareViews.
private void prepareViews() {
LinearLayoutManager layoutManager = new SmoothScrollLinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
prepareMenu();
if (adapter == null) {
adapter = new FlexibleAdapter<>(menuItems, getActivity(), false);
}
adapter.addListener(this);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), layoutManager.getOrientation()));
}
use of eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager in project talk-android by nextcloud.
the class ContactsController method prepareViews.
private void prepareViews() {
layoutManager = new SmoothScrollLinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), layoutManager.getOrientation()));
swipeRefreshLayout.setOnRefreshListener(this::fetchData);
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
fastScroller.addOnScrollStateChangeListener(this);
adapter.setFastScroller(fastScroller);
fastScroller.setBubbleTextCreator(position -> {
IFlexible abstractFlexibleItem = adapter.getItem(position);
if (abstractFlexibleItem instanceof UserItem) {
return ((UserItem) adapter.getItem(position)).getHeader().getModel();
} else {
return ((UserHeaderItem) adapter.getItem(position)).getModel();
}
});
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) bottomButtonsLinearLayout.getLayoutParams();
layoutParams.setBehavior(new ViewHidingBehaviourAnimation());
}
use of eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager in project FlexibleAdapter by davideas.
the class FragmentViewPager method initializeRecyclerView.
private void initializeRecyclerView() {
// Initialize Adapter and RecyclerView
// Use of stableIds, I strongly suggest to implement 'item.hashCode()'
FlexibleAdapter.useTag("ViewPagerAdapter");
mAdapter = new FlexibleAdapter<>(createList(50, 5), getActivity(), true);
mAdapter.setAnimationOnForwardScrolling(DatabaseConfiguration.animateOnForwardScrolling);
RecyclerView mRecyclerView = getView().findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivity()));
mRecyclerView.setAdapter(mAdapter);
// Size of RV will not change
mRecyclerView.setHasFixedSize(true);
// NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
// a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
// Add FastScroll to the RecyclerView, after the Adapter has been attached the RecyclerView!!!
FastScroller fastScroller = getView().findViewById(R.id.fast_scroller);
mAdapter.setFastScroller(fastScroller);
// Sticky Headers
mAdapter.setDisplayHeadersAtStartUp(true).setStickyHeaders(true);
}
Aggregations