Skip to content

Commit

Permalink
1. change status layout
Browse files Browse the repository at this point in the history
  • Loading branch information
beiger committed Nov 25, 2018
1 parent 6ff34cc commit dfd73a3
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView;

public abstract class BaseRecycleViewAdapter<T extends IsSame, VH extends BaseViewHolder> extends RecyclerView.Adapter<VH> {
public abstract class BaseRecycleViewAdapter<T extends IsSame> extends RecyclerView.Adapter<BaseViewHolder> {
protected List<T> mData = new ArrayList<>();
protected OnClickListener mListener;

Expand All @@ -25,7 +25,7 @@ public List<T> getData() {

@NonNull
@Override
public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return createHolder(parent, viewType);
}

Expand All @@ -34,13 +34,13 @@ protected ViewDataBinding getBinding(@NonNull ViewGroup parent, int viewType, in
return DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), layoutId, parent, false);
}

protected abstract VH createHolder(@NonNull ViewGroup parent, int viewType);
protected abstract BaseViewHolder createHolder(@NonNull ViewGroup parent, int viewType);

/**
* 子类不用继承
*/
@Override
public void onBindViewHolder(@NonNull VH holder, final int position) {
public void onBindViewHolder(@NonNull BaseViewHolder holder, final int position) {
holder.mBinding.getRoot().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand All @@ -53,7 +53,7 @@ public void onClick(View v) {
holder.mBinding.executePendingBindings();
}

protected abstract void bindData(VH holder, final int position);
protected abstract void bindData(BaseViewHolder holder, final int position);

@Override
public int getItemCount() {
Expand Down

0 comments on commit dfd73a3

Please sign in to comment.