miguelbcr / okadapters Goto Github PK
View Code? Open in Web Editor NEWWrappers for Android adapters to simply its api at a minimum.
License: Apache License 2.0
Wrappers for Android adapters to simply its api at a minimum.
License: Apache License 2.0
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
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 OnItemRemoved
is never called
adapter.swipeToRemoveItemOn(recyclerView)
.withUndoAction()
.notifyOnRemoved(item->
// Never called if several items are swipe quickly, only called for the last
);
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.