| | |
| | | package cn.com.basic.face.widget.phonecall;
|
| | |
|
| | | import android.content.Context;
|
| | | import android.os.Parcelable;
|
| | | import android.util.AttributeSet;
|
| | |
|
| | | import com.camnter.easyrecyclerview.widget.EasyRecyclerView;
|
| | |
| | | public class PhoneCallLeftListView extends EasyRecyclerView {
|
| | |
|
| | | private PhoneCallLeftAdapter adapter ;
|
| | | private Parcelable recyclerViewState;
|
| | |
|
| | | private void initView() {
|
| | | adapter = new PhoneCallLeftAdapter();
|
| | |
| | | }
|
| | |
|
| | | public void show(boolean isSortByDept, List list, boolean append) {
|
| | | if (append) {
|
| | | List newList = new ArrayList();
|
| | | if (adapter.getList().size() > 0 && adapter.getList().get(adapter.getList().size()-1) instanceof Integer && ((int)adapter.getList().get(adapter.getList().size()-1))== CommonVariables.Page.hasMorePages) {
|
| | | adapter.getList().remove(adapter.getList().size() - 1);
|
| | | }
|
| | | if (adapter.getList().size() > 0 && adapter.getList().get(adapter.getList().size()-1) instanceof
|
| | | Integer && ((int)adapter.getList().get(adapter.getList().size()-1))== CommonVariables.Page.noMorePage) {
|
| | | adapter.getList().remove(adapter.getList().size() - 1);
|
| | | }
|
| | | newList.addAll(adapter.getList());
|
| | | newList.addAll(list);
|
| | | if (adapter.getList().size() > 0) {
|
| | | this.scrollToPosition(adapter.getList().size()-1);
|
| | | }
|
| | | adapter.setList(newList);
|
| | | } else {
|
| | | adapter.setList(list);
|
| | | }
|
| | | recyclerViewState = this.getLayoutManager().onSaveInstanceState();
|
| | | adapter.setList(list);
|
| | | setAdapter(adapter);
|
| | | adapter.setSortByDept(isSortByDept);
|
| | | this.getLayoutManager().onRestoreInstanceState(recyclerViewState);
|
| | | }
|
| | |
|
| | | public List getPrevList() {
|
| | | return adapter.getList();
|
| | | }
|
| | |
|
| | | }
|