diff --git a/build.gradle b/build.gradle index e1a253c..c457c13 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.1' + classpath 'com.android.tools.build:gradle:2.3.2' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/library/src/main/java/me/donnie/adapter/BaseAdapter.java b/library/src/main/java/me/donnie/adapter/BaseAdapter.java index 0db3e75..93d14a4 100644 --- a/library/src/main/java/me/donnie/adapter/BaseAdapter.java +++ b/library/src/main/java/me/donnie/adapter/BaseAdapter.java @@ -11,7 +11,7 @@ * @description */ -public abstract class BaseAdapter extends MultiItemAdapter { +public abstract class BaseAdapter extends MultiItemAdapter { public BaseAdapter(final int layoutResId, List datas) { super(datas); diff --git a/library/src/main/java/me/donnie/adapter/MultiItemAdapter.java b/library/src/main/java/me/donnie/adapter/MultiItemAdapter.java index 78f10fd..9423c59 100644 --- a/library/src/main/java/me/donnie/adapter/MultiItemAdapter.java +++ b/library/src/main/java/me/donnie/adapter/MultiItemAdapter.java @@ -34,7 +34,7 @@ * @description */ -public abstract class MultiItemAdapter extends RecyclerView.Adapter { +public abstract class MultiItemAdapter extends RecyclerView.Adapter { private static final String TAG = MultiItemAdapter.class.getSimpleName(); @@ -160,17 +160,17 @@ public int getItemViewType(int position) { } @Override - public K onCreateViewHolder(ViewGroup parent, int viewType) { + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { mContext = parent.getContext(); this.mInflater = LayoutInflater.from(mContext); ItemViewDelegate itemViewDelegate = mItemViewDelegateManager.getItemViewDelegate(viewType); - K holder = (K) K.createBaseViewHolder(mContext, parent, itemViewDelegate.getItemViewLayoutId()); + ViewHolder holder = ViewHolder.createBaseViewHolder(mContext, parent, itemViewDelegate.getItemViewLayoutId()); bindViewClickListener(holder); return holder; } @Override - public void onBindViewHolder(K holder, int position) { + public void onBindViewHolder(ViewHolder holder, int position) { convert(holder, mDatas.get(position)); } @@ -201,7 +201,7 @@ protected void startAnim(Animator animator, int position) { animator.setInterpolator(mInterpolator); } - public void convert(K holder, T t) { + public void convert(ViewHolder holder, T t) { mItemViewDelegateManager.convert(holder, t, holder.getAdapterPosition()); } diff --git a/library/src/main/java/me/donnie/adapter/Walle.java b/library/src/main/java/me/donnie/adapter/Walle.java index 2dfa933..9cd7dbc 100644 --- a/library/src/main/java/me/donnie/adapter/Walle.java +++ b/library/src/main/java/me/donnie/adapter/Walle.java @@ -146,6 +146,10 @@ public WrapperAdapter getWrapperAdapter() { return wrapperAdapter; } + public void addTo(RecyclerView recyclerView) { + recyclerView.setAdapter(wrapperAdapter); + } + private class WrapperAdapter extends RecyclerView.Adapter { private static final int VIEW_TYPE_EMPTY = 1;