Search in sources :

Example 71 with DefaultItemAnimator

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();
}
Also used : ScrollableUseCaseItem(eu.davidea.samples.flexibleadapter.items.ScrollableUseCaseItem) ExampleAdapter(eu.davidea.samples.flexibleadapter.ExampleAdapter) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 72 with DefaultItemAnimator

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)));
}
Also used : ScrollableUseCaseItem(eu.davidea.samples.flexibleadapter.items.ScrollableUseCaseItem) ExampleAdapter(eu.davidea.samples.flexibleadapter.ExampleAdapter) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 73 with DefaultItemAnimator

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;
}
Also used : SimpleDividerItemDecoration(org.andydyer.androidtestdemo.ui.widgets.SimpleDividerItemDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) InjectView(butterknife.InjectView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 74 with DefaultItemAnimator

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);
    }
}
Also used : DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 75 with DefaultItemAnimator

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);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) PhotoListAdapter(com.alexvasilkov.gestures.sample.adapters.PhotoListAdapter) EndlessRecyclerAdapter(com.alexvasilkov.gestures.sample.adapters.EndlessRecyclerAdapter) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)103 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)72 RecyclerView (android.support.v7.widget.RecyclerView)63 View (android.view.View)55 TextView (android.widget.TextView)30 ImageView (android.widget.ImageView)25 ArrayList (java.util.ArrayList)16 ClickItemTouchListener (com.sdsmdg.harjot.MusicDNA.clickitemtouchlistener.ClickItemTouchListener)14 GridLayoutManager (android.support.v7.widget.GridLayoutManager)13 Toolbar (android.support.v7.widget.Toolbar)13 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)10 FastAdapter (com.mikepenz.fastadapter.FastAdapter)10 UnifiedTrack (com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack)10 MaterializeBuilder (com.mikepenz.materialize.MaterializeBuilder)9 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)8 LocalTrack (com.sdsmdg.harjot.MusicDNA.models.LocalTrack)8 DividerItemDecoration (de.madcyph3r.example.DividerItemDecoration)8 Button (android.widget.Button)7 Random (java.util.Random)6 Intent (android.content.Intent)5