use of android.support.v7.widget.DefaultItemAnimator in project FlexibleAdapter by davideas.
the class FragmentHeadersSections method initializeRecyclerView.
@SuppressWarnings({ "ConstantConditions", "NullableProblems" })
private void initializeRecyclerView(Bundle savedInstanceState) {
// Initialize Adapter and RecyclerView
// ExampleAdapter makes use of stableIds, I strongly suggest to implement 'item.hashCode()'
mAdapter = new ExampleAdapter(DatabaseService.getInstance().getDatabaseList(), getActivity());
// Experimenting NEW features (v5.0.0)
//We have highlighted text while filtering, so let's enable this feature to be consistent with the active filter
mAdapter.setNotifyChangeOfUnfilteredItems(true).setAnimationOnScrolling(DatabaseConfiguration.animateOnScrolling);
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(createNewLinearLayoutManager());
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!!!
mAdapter.setFastScroller((FastScroller) getView().findViewById(R.id.fast_scroller), Utils.getColorAccent(getActivity()), (MainActivity) getActivity());
mAdapter.setLongPressDragEnabled(true).setHandleDragEnabled(true).setSwipeEnabled(true).setUnlinkAllItemsOnRemoveHeaders(true).setDisplayHeadersAtStartUp(true).setStickyHeaders(true).setDisplayHeadersAtStartUp(true).showAllHeaders();
SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setEnabled(true);
mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_IDLE);
// Add 3 Scrollable Headers and 1 Footer
mAdapter.addUserLearnedSelection(savedInstanceState == null);
mAdapter.addScrollableHeaderWithDelay(new ScrollableUseCaseItem(getString(R.string.headers_sections_use_case_title), getString(R.string.headers_sections_use_case_description)), 900L, false);
mAdapter.showLayoutInfo(savedInstanceState == null);
mAdapter.addScrollableFooter();
}
use of android.support.v7.widget.DefaultItemAnimator in project FlexibleAdapter by davideas.
the class FragmentHolderSections method initializeRecyclerView.
@SuppressWarnings({ "ConstantConditions", "NullableProblems" })
private void initializeRecyclerView(Bundle savedInstanceState) {
// Initialize Adapter and RecyclerView
// ExampleAdapter makes use of stableIds, I strongly suggest to implement 'item.hashCode()'
mAdapter = new ExampleAdapter(DatabaseService.getInstance().getDatabaseList(), getActivity());
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(createNewLinearLayoutManager());
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!!!
mAdapter.setFastScroller((FastScroller) getView().findViewById(R.id.fast_scroller), Utils.getColorAccent(getActivity()), (MainActivity) getActivity());
mAdapter.setDisplayHeadersAtStartUp(true).setStickyHeaders(true).setOnlyEntryAnimation(true);
SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setEnabled(true);
mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_IDLE);
// Add 1 Scrollable Header
mAdapter.addScrollableHeader(new ScrollableUseCaseItem(getString(R.string.model_holders_use_case_title), getString(R.string.model_holders_use_case_description)));
}
use of android.support.v7.widget.DefaultItemAnimator in project android-test-demo by abdyer.
the class EventListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_event_list, container, false);
ButterKnife.inject(this, view);
if (savedInstanceState == null) {
adapter = new EventsAdapter();
}
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity()));
recyclerView.setAdapter(adapter);
return view;
}
use of android.support.v7.widget.DefaultItemAnimator in project actor-platform by actorapp.
the class DisplayListFragment method setAnimationsEnabled.
public void setAnimationsEnabled(boolean isEnabled) {
if (isEnabled) {
DefaultItemAnimator itemAnimator = new DefaultItemAnimator();
// CustomItemAnimator itemAnimator = new CustomItemAnimator();
itemAnimator.setSupportsChangeAnimations(false);
itemAnimator.setMoveDuration(200);
itemAnimator.setAddDuration(150);
itemAnimator.setRemoveDuration(200);
collection.setItemAnimator(itemAnimator);
} else {
collection.setItemAnimator(null);
}
}
use of android.support.v7.widget.DefaultItemAnimator in project GestureViews by alexvasilkov.
the class Ex6AdvancedDemoActivity method initGrid.
private void initGrid() {
// Setting up images grid
final int cols = getResources().getInteger(R.integer.images_grid_columns);
views.grid.setLayoutManager(new GridLayoutManager(this, cols));
views.grid.setItemAnimator(new DefaultItemAnimator());
gridAdapter = new PhotoListAdapter(this);
gridAdapter.setLoadingOffset(PAGE_SIZE / 2);
gridAdapter.setCallbacks(new EndlessRecyclerAdapter.LoaderCallbacks() {
@Override
public boolean canLoadNextItems() {
return gridAdapter.canLoadNext();
}
@Override
public void loadNextItems() {
// We should either load all items that were loaded before state save / restore,
// or next page if we already loaded all previously shown items
int count = Math.max(savedPhotoCount, gridAdapter.getCount() + PAGE_SIZE);
Events.create(FlickrApi.LOAD_IMAGES_EVENT).param(count).post();
}
});
views.grid.setAdapter(gridAdapter);
}
Aggregations