GithubHelp home page GithubHelp logo

okadapters's People

Contributors

miguelbcr avatar victoralbertos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

victoralbertos

okadapters's Issues

Please add a license

This repo is missing a license. Without a license, all code is copyright the author and may not be used by anyone else.

Please use something like http://choosealicense.com/ to decide what license to use. I recommend MIT or GPL

Bug when removing several items by swiping

Currently the item is removed when Snackbar.Callback.DISMISS_EVENT_TIMEOUT event is triggered, but if you remove several items quickly the Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE event is triggered so the items are not remove really because only remove item from adapter but OnItemRemovedis never called

        adapter.swipeToRemoveItemOn(recyclerView)
                .withUndoAction()
                .notifyOnRemoved(item->
                    // Never called if several items are swipe quickly, only called for the last
                );

Use different value for LOADING_VIEW_TYPE

If I have a class that inherits from OkRecyclerViewAdapter, and want to use differents xml, i'll need to override getItemViewType.

public abstract class OkRecyclerViewAdapter<T, V extends View & OkRecyclerViewAdapter.Binder<T>> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    protected List<T> items = new ArrayList<>();
    protected Listener<T, V> listener;
    private RxPager<T, V> rxPager;
    private final static int LOADING_VIEW_TYPE = 1, ITEM_VIEW_TYPE = 2;
    boolean removeMoreListener;

    @Override public final RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (viewType == LOADING_VIEW_TYPE) {
            View view = LayoutInflater.from(parent.getContext()).inflate(rxPager.getIdResourceLoading(), parent, false);
            return new ViewHolderPagerLoading(view);
        }

        return new BindView<>(onCreateItemView(parent, viewType));
    }


    @Override public int getItemViewType(int position) {
        if (position == items.size() && rxPager != null && !rxPager.isAllLoaded()) return LOADING_VIEW_TYPE;
        return ITEM_VIEW_TYPE;
    }

So right now I'm not allow to use values 1 and 2 for my items, I believe it would be better if those values are available so I can define my viewTypes like:

    private final static int ITEM_TYPE_ONE = 0, ITEM_TYPE_TWO = 1;

Instead of:

    private final static int ITEM_TYPE_ONE = 3, ITEM_TYPE_TWO = 4;

It's just an idea, not necessary

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.