Search in sources :

Example 11 with DefaultItemAnimator

use of androidx.recyclerview.widget.DefaultItemAnimator in project UltimateRecyclerView by cymcsg.

the class GridLayoutRVTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getMainLayout());
    mToolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    listuv = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
    mGridAdapter = new GridJRAdapter(getJRList());
    mGridAdapter.setSpanColumns(columns);
    mGridLayoutManager = new BasicGridLayoutManager(this, columns, mGridAdapter);
    listuv.setLayoutManager(mGridLayoutManager);
    listuv.setHasFixedSize(true);
    listuv.setSaveEnabled(true);
    listuv.setClipToPadding(false);
    // mGridAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));
    listuv.setNormalHeader(setupHeaderView());
    final Handler f = new Handler();
    listuv.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() {

        @Override
        public void loadMore(int itemsCount, int maxLastVisiblePosition) {
            // Log.d(TAG, itemsCount + " :: " + itemsCount);
            f.postDelayed(new Runnable() {

                @Override
                public void run() {
                    mGridAdapter.insert(SampleDataboxset.genJRList(5));
                    afterAdd();
                }
            }, 2000);
        }
    });
    // listuv.enableLoadmore();
    // listuv.disableLoadmore();
    listuv.setLoadMoreView(R.layout.custom_bottom_progressbar);
    listuv.setAdapter(mGridAdapter);
    listuv.setItemAnimator(new DefaultItemAnimator());
    harness_control();
}
Also used : BasicGridLayoutManager(com.marshalchen.ultimaterecyclerview.grid.BasicGridLayoutManager) UltimateRecyclerView(com.marshalchen.ultimaterecyclerview.UltimateRecyclerView) Handler(android.os.Handler) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Example 12 with DefaultItemAnimator

use of androidx.recyclerview.widget.DefaultItemAnimator in project PocketMaps by junjunguo.

the class GeocodeActivity method showAddresses.

private RecyclerView showAddresses(final List<Address> list, final boolean viewOnly) {
    setContentView(R.layout.activity_addresses);
    OnClickAddressListener l = new OnClickAddressListener() {

        @Override
        public void onClick(Address addr) {
            log("Address selected: " + addr);
            if (viewOnly) {
                GeocodeActivity.backToListViewOnly = true;
                GeocodeActivity.backToListData = list;
            }
            GeocodeActivity.this.finish();
            if (callbackListener != null) {
                callbackListener.onClick(addr);
            }
        }
    };
    OnClickAddressListener detL = new OnClickAddressListener() {

        @Override
        public void onClick(Address addr) {
            log("Address details selected: " + addr);
            backToListData = list;
            backToListViewOnly = viewOnly;
            if (viewOnly) {
                GeocodeActivity.this.showAddressDetails(EditType.ViewOnly, addr);
            } else {
                GeocodeActivity.this.showAddressDetails(EditType.ViewEdit, addr);
            }
        }
    };
    MyAddressAdapter adapter = new MyAddressAdapter(list, l, detL);
    RecyclerView listView = (RecyclerView) findViewById(R.id.my_addr_recycler_view);
    listView.setHasFixedSize(true);
    // use a linear layout manager
    LinearLayoutManager layoutManager = new LinearLayoutManager(this.getApplicationContext());
    layoutManager.setOrientation(RecyclerView.VERTICAL);
    listView.setLayoutManager(layoutManager);
    listView.setItemAnimator(new DefaultItemAnimator());
    listView.setAdapter(adapter);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.my_addr_add_fab);
    if (!isFavouritesView()) {
        fab.setVisibility(View.INVISIBLE);
    } else {
        fab.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                log("Plus selected!");
                showAddressDetails(EditType.EditOnly, null);
            }
        });
    }
    if (!viewOnly) {
        addDeleteItemHandler(listView);
    }
    ;
    return listView;
}
Also used : Address(android.location.Address) MyAddressAdapter(com.junjunguo.pocketmaps.fragments.MyAddressAdapter) OnClickAddressListener(com.junjunguo.pocketmaps.model.listeners.OnClickAddressListener) FloatingActionButton(com.google.android.material.floatingactionbutton.FloatingActionButton) RecyclerView(androidx.recyclerview.widget.RecyclerView) OnClickListener(android.view.View.OnClickListener) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) AutoCompleteTextView(android.widget.AutoCompleteTextView) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Example 13 with DefaultItemAnimator

use of androidx.recyclerview.widget.DefaultItemAnimator in project PocketMaps by junjunguo.

the class MainActivity method activateRecyclerView.

/**
 * active directions, and directions view
 */
private void activateRecyclerView(List<MyMap> myMaps) {
    RecyclerView.LayoutManager layoutManager;
    mapsRV = (RecyclerView) findViewById(R.id.my_maps_recycler_view);
    DefaultItemAnimator animator = new DefaultItemAnimator();
    animator.setAddDuration(2000);
    animator.setRemoveDuration(600);
    mapsRV.setItemAnimator(animator);
    // use this setting to improve performance if you know that changes
    // in content do not change the layout size of the RecyclerView
    mapsRV.setHasFixedSize(true);
    // use a linear layout manager
    layoutManager = new LinearLayoutManager(this);
    mapsRV.setLayoutManager(layoutManager);
    // specify an adapter (see also next example)
    if (mapAdapter == null) {
        mapAdapter = new MyMapAdapter(myMaps, this, false);
    } else {
        mapAdapter.clearList();
        mapAdapter.addAll(myMaps);
    }
    mapsRV.setAdapter(mapAdapter);
    deleteItemHandler();
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) MyMapAdapter(com.junjunguo.pocketmaps.fragments.MyMapAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Example 14 with DefaultItemAnimator

use of androidx.recyclerview.widget.DefaultItemAnimator in project MaxLock by Maxr1998.

the class AppListFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getActivity().setTitle(getString(R.string.pref_screen_apps));
    // noinspection ConstantConditions
    ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    rootView = (ViewGroup) inflater.inflate(R.layout.fragment_appslist, container, false);
    // Setup layout
    RecyclerView recyclerView = rootView.findViewById(R.id.app_list);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(appListModel.getAdapter());
    return rootView;
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Example 15 with DefaultItemAnimator

use of androidx.recyclerview.widget.DefaultItemAnimator in project MVPArms by JessYanCoding.

the class ArmsUtils method configRecyclerView.

/**
 * 配置 RecyclerView
 *
 * @param recyclerView
 * @param layoutManager
 */
public static void configRecyclerView(final RecyclerView recyclerView, RecyclerView.LayoutManager layoutManager) {
    recyclerView.setLayoutManager(layoutManager);
    // 如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
    recyclerView.setHasFixedSize(true);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
Also used : DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (androidx.recyclerview.widget.DefaultItemAnimator)27 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)14 RecyclerView (androidx.recyclerview.widget.RecyclerView)12 View (android.view.View)9 SwipeRefreshLayout (androidx.swiperefreshlayout.widget.SwipeRefreshLayout)9 TextView (android.widget.TextView)6 FastScroller (eu.davidea.fastscroller.FastScroller)6 FlexibleItemDecoration (eu.davidea.flexibleadapter.common.FlexibleItemDecoration)6 ExampleAdapter (eu.davidea.samples.flexibleadapter.ExampleAdapter)5 SuppressLint (android.annotation.SuppressLint)3 Intent (android.content.Intent)3 Bundle (android.os.Bundle)3 ScrollableUseCaseItem (eu.davidea.samples.flexibleadapter.items.ScrollableUseCaseItem)3 Context (android.content.Context)2 Resources (android.content.res.Resources)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 ListView (android.widget.ListView)2 SearchView (androidx.appcompat.widget.SearchView)2 BottomSheetDialog (com.google.android.material.bottomsheet.BottomSheetDialog)2