| | |
| | | package cn.com.basic.face.widget.checkin;
|
| | |
|
| | | import android.content.Context;
|
| | | import android.os.Parcelable;
|
| | | import android.support.v7.widget.RecyclerView;
|
| | | import android.util.AttributeSet;
|
| | |
|
| | |
| | |
|
| | | private CheckInFragment.CheckInLeftVisitorAdapter adapter = new CheckInFragment.CheckInLeftVisitorAdapter();
|
| | | private List list = new ArrayList();
|
| | | private Parcelable recyclerViewState;
|
| | |
|
| | | public void setAdapter(Context context) {
|
| | | setAdapter(adapter);
|
| | |
| | | setAdapter(context);
|
| | | }
|
| | |
|
| | | public void show(List list, boolean append) {
|
| | | refresh(list, append);
|
| | | }
|
| | |
|
| | | 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);
|
| | | }
|
| | | public void show(List list) {
|
| | | recyclerViewState = this.getLayoutManager().onSaveInstanceState();
|
| | | adapter.setList(list);
|
| | | this.setAdapter(adapter);
|
| | | adapter.notifyDataSetChanged();
|
| | | this.getLayoutManager().onRestoreInstanceState(recyclerViewState);
|
| | | }
|
| | |
|
| | | public List getPrevList() {
|
| | | return adapter.getList();
|
| | | }
|
| | | }
|