| | |
| | | package cn.com.basic.face.widget.checkin;
|
| | |
|
| | | import android.content.Context;
|
| | | import android.support.v7.widget.RecyclerView;
|
| | | import android.util.AttributeSet;
|
| | |
|
| | | import com.camnter.easyrecyclerview.adapter.EasyRecyclerViewAdapter;
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.adapter.CheckInFragment;
|
| | | import cn.com.basic.face.discern.common.CommonVariables;
|
| | |
|
| | | public class CheckInLeftVisitor extends EasyRecyclerView {
|
| | |
|
| | | private CheckInFragment.CheckInLeftVisitorAdapter mAdapter = new CheckInFragment.CheckInLeftVisitorAdapter();
|
| | | private CheckInFragment.CheckInLeftVisitorAdapter adapter = new CheckInFragment.CheckInLeftVisitorAdapter();
|
| | | private List list = new ArrayList();
|
| | |
|
| | | public void setAdapter(Context context) {
|
| | | setAdapter(mAdapter);
|
| | | setAdapter(adapter);
|
| | | }
|
| | |
|
| | | public CheckInLeftVisitor(Context context) {
|
| | |
| | | setAdapter(context);
|
| | | }
|
| | |
|
| | | public void show(List list) {
|
| | | refresh(list);
|
| | | public void show(List list, boolean append) {
|
| | | refresh(list, append);
|
| | | }
|
| | |
|
| | | public void refresh(List list) {
|
| | | this.list.clear();
|
| | | this.list.addAll(list);
|
| | | mAdapter.setList(this.list);
|
| | | this.setAdapter(mAdapter);
|
| | | public void refresh(List theNewList, boolean append) {
|
| | | if (append) {
|
| | | List oldList = adapter.getList();
|
| | | List newList = new ArrayList();
|
| | | if (oldList.size() > 0 && oldList.get(oldList.size()-1) instanceof Integer &&
|
| | | ((int)oldList.get(oldList.size()-1))== CommonVariables.Page.hasMorePages) {
|
| | | oldList.remove(oldList.size() - 1);
|
| | | }
|
| | | if (oldList.size() > 0 && oldList.get(oldList.size()-1) instanceof
|
| | | Integer && ((int)oldList.get(oldList.size()-1))== CommonVariables.Page.noMorePage) {
|
| | | oldList.remove(oldList.size() - 1);
|
| | | }
|
| | | if (oldList.size() > 0) {
|
| | | this.scrollToPosition(oldList.size()-1);
|
| | | }
|
| | | oldList.addAll(theNewList);
|
| | | } else {
|
| | | adapter.setList(theNewList);
|
| | | }
|
| | | this.setAdapter(adapter);
|
| | | adapter.notifyDataSetChanged();
|
| | | }
|
| | |
|
| | |
|
| | | }
|